<template>
    <div class='warning_link '>
        <div class="link_tab" >
            <el-tabs 
               tab-position="left" 
               class="link_tabs" 
               type="border-card" 
               v-loading="loading" 
               element-loading-text="加载中……"
               element-loading-spinner="el-icon-loading"
               element-loading-background="rgba(0, 0, 0, 0.5)">
                <!-- 联动 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-connection"></i> 联动</span>
                    <div class="meanTab_add">
                            <p class="config_title_add" @click="getlinklist(0)">
                                <i class="el-icon-circle-plus-outline"></i> 
                            </p>
                        </div>
                    <div class="linkList">
                        <div class="linkList_eidt" v-for="(item,index) in this.listLocal" :key="index">
                            <div class="linkList_name">名称：{{item.name}}</div>
                            <div class="linkList_eidt_flex">
                                <div class="linkList_activity">
                                    <div class="linkList_ac">
                                       <el-switch
                                            @change="changeValue(index, item)"
                                            v-model="item.activity"
                                            active-color="#13ce66"
                                            inactive-color="#ff4949">
                                        </el-switch> 
                                    </div>
                                    <div class="linkList_nr">
                                        <div class="linkList_nr_flex">
                                            <div class="linkList_nr_div">
                                                <div v-if="item.timeslotList.length == 0">
                                                    <span>时间运行区间：未设置（默认全天执行）</span>
                                                </div>
                                                <div v-if="item.timeslotList.length > 0">
                                                    <span>时间运行区间：</span>
                                                    <span v-if="item.timeslotList[0].unit == undefined">{{item.timeslotList[0].name}}</span>
                                                    <span v-if="item.timeslotList[0].unit != undefined">{{ChangeHourMinutestr(item.timeslotList[0].unit.startTime)}} - {{ChangeHourMinutestr(item.timeslotList[0].unit.endTime)}}</span>
                                                    <span v-if="item.timeslotList.length > 1">&nbsp; …</span>
                                                </div>
                                            </div>
                                            <div class="linkList_nr_div">触发动作数量：{{item.center.length+item.start.length+item.end.length}}</div>
                                        </div>
                                    </div>
                                    <div class="linkList_"></div>
                                </div>
                                <div class="linkList_but">
                                    <i class="el-icon-edit-outline" @click="getlinklist(1,item)" title="编辑"></i> 
                                    <i class="el-icon-delete linkList_but_delete" @click="linklistDel(index,item)" title="删除"></i>
                                </div>
                            </div>
                            
                        </div>
                        
                    </div>
                </el-tab-pane>
                <!-- 平均值模块 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-s-data"></i> 平均模块</span>
                    <div class="meanTab">
                        <div class="meanTab_add">
                            <p class="config_title_add" @click="getmeanTab(0)">
                                <i class="el-icon-circle-plus-outline"></i> 
                            </p>
                        </div>
                        <div class="meanTabList">
                            <div class="meanTab_eidt" v-for="(item,index) in this.meanList" :key="index">
                                <div class="meanTab_name">{{item.name}}</div>
                                <div class="meanTab_but">
                                    <i class="el-icon-edit-outline clickD" @click="getmeanTab(1,item)" title="编辑"></i> 
                                    <i class="el-icon-delete meanTab_but_delete clickD" @click="getmeanDel(index,item)" title="删除"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-tab-pane>
                <!-- 控制模块 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-s-grid"></i> 控制模块</span>
                    <div class="meanTab">
                        <div class="meanTab_add">
                            <p class="config_title_add" @click="getgroupTab(0)">
                                <i class="el-icon-circle-plus-outline"></i> 
                            </p>
                        </div>
                        <div class="meanTabList">
                            <div class="meanTab_eidt" v-for="(item,index) in this.groupList" :key="index">
                                <div class="meanTab_name">{{item.name}}</div>
                                <div class="meanTab_but">
                                    <i class="el-icon-edit-outline clickD" @click="getgroupTab(1,item)" title="编辑"></i> 
                                    <i class="el-icon-delete meanTab_but_delete clickD" @click="getgroupDel(index,item)" title="删除"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-tab-pane>
                <!-- 时间模块 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-date"></i> 时间模块</span>
                    <div class="meanTab">
                        <div class="meanTab_add">
                            <p class="config_title_add" @click="gettimeTab(0)">
                                <i class="el-icon-circle-plus-outline"></i> 
                            </p>
                        </div>
                        <div class="meanTabList">
                            <div class="meanTab_eidt" v-for="(item,index) in this.timeList" :key="index">
                                <div class="meanTab_name">{{item.name}}</div>
                                <div class="meanTab_but">
                                    <i class="el-icon-edit-outline clickD"  @click="gettimeTab(1,item,index)" title="编辑"></i> 
                                    <i class="el-icon-delete meanTab_but_delete clickD" @click="gettimeDel(index,item.uid)" title="删除"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-tab-pane>
                <!-- 空气质量 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-stopwatch"></i> 空气质量</span>
                    <div class="meanTab">
                        <div class="airlimit">
                            <div class="airlimit_title">粉尘等级优高限值：</div>
                            <div class="airlimit_value">
                                <el-input v-model="airlimit.dustlimit1"></el-input>
                            </div>
                        </div>
                        <div class="airlimit">
                            <div class="airlimit_title">粉尘等级优低限值：</div>
                            <div class="airlimit_value">
                                <el-input v-model="airlimit.dustlimit2"></el-input>
                            </div>
                        </div>
                        <div class="airlimit">
                            <div class="airlimit_title">污染等级优高限值：</div>
                            <div class="airlimit_value">
                                <el-input v-model="airlimit.pollutelimit1"></el-input>
                            </div>
                        </div>
                        <div class="airlimit">
                            <div class="airlimit_title">污染等级优低限值：</div>
                            <div class="airlimit_value">
                                <el-input v-model="airlimit.pollutelimit2"></el-input>
                            </div>
                        </div>
                        <div class="airlimit_save">
                            <el-button type="primary" @click="airlimitSave()">保存</el-button>
                        </div>
                    </div>
                </el-tab-pane>
                <!-- 红外布防 -->
                <el-tab-pane>
                    <span slot="label"><i class="el-icon-stopwatch"></i> 红外布防</span>
                    <div class="meanTab">
                        <Infrared/>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </div>
        <!-- 联动内容设置 -->
        <el-dialog
            :title="this.linkTitle"
            :visible.sync="linkList"
            :show-close="false"
            class="dialog_link"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            width="80%"
            :append-to-body="true">
            <div class="link_t">
                <el-form :model="linkListData">
                    <div class="link_box">
                        <div class="link_box_name">
                            <el-form-item label="名称:" label-width="20%">
                                <el-input v-model="linkListData.name" autocomplete="off"></el-input>
                            </el-form-item>
                        </div>
                        <div class="link_box_timez">
                            <img src="../../assets/time.png" alt="">
                        </div>
                        <div class="link_box_table">
                            <div class="link_box_logic">
                                <!-- 开始触发动作 -->
                                <div class="link_box_soperate">
                                    <div class="link_box_start">触发动作</div>
                                    <div class="link_box_start_add">
                                        <div class="link_box_tlogic_add">
                                            <p class="link_box_tlogic_add_p" @click="getlinkgroup(0,'start')">
                                                <i class="el-icon-circle-plus-outline"></i> 
                                            </p>
                                        </div>
                                        <div class="link_box_logic_control">
                                            <vuedraggable v-model="start">
                                                <div class="link_box_logic_control_item" v-for="item in start" :key="item.uid">
                                                    <div class="link_box_logic_control_name" :title="item.name">{{item.name}}</div>
                                                    <div class="link_box_logic_control_flex">
                                                        <p><i class="el-icon-edit-outline" @click="getlinkgroup(1,item,'start')" title="编辑"></i> </p>
                                                        <p><i class="el-icon-delete" @click="getlinkgroupDele('start',item)" title="删除"></i></p>
                                                    </div>
                                                </div>
                                            </vuedraggable>
                                        </div>
                                    </div>
                                </div>
                                <!-- 时间段触发动作 -->
                                <div class="link_box_loperate" style="padding-top: 0px;">
                                    <div class="link_box_start" style="margin-bottom: 0px;">时间段</div>
                                    <div class="link_box_time_logic">
                                        <div class="link_box_tlogic_add">
                                            <p class="link_box_tlogic_add_p" @click="getlinkTime()">
                                                <i class="el-icon-circle-plus-outline"></i> 
                                            </p>
                                        </div>
                                        <div class="link_box_tlogic">
                                            <div class="link_box_tlogic_timeflex">
                                                <div class="link_box_tlogic_timefor" v-for="(item,index) in this.timeslotList " :key=index >
                                                    <div class="link_box_tlogic_timefor_reprat" :style="item.repeat == 1 ? 'border: 1px solid #ff270052;box-shadow: 0px 0px 5px 0px #ff2700;':''">
                                                        <div v-if="item.unit == undefined" @click="linkTimerepeat(item)">
                                                            <span style="cursor: pointer;" @click="linkTimeLook(item)">{{item.name}}</span>
                                                        </div>
                                                        <div v-if="item.unit != undefined" class="link_box_tlogic_timefor_unit"  @click="linkTimerepeat(item)">
                                                            <div>{{ChangeHourMinutestr(item.unit.startTime)}} - {{ChangeHourMinutestr(item.unit.endTime)}}</div>
                                                            <div v-if="item.unit.cycle == 0">每天</div>
                                                            <div v-if="item.unit.cycle == 1">
                                                                <span v-if="item.unit.week == 1">每周一</span>
                                                                <span v-if="item.unit.week == 2">每周二</span>
                                                                <span v-if="item.unit.week == 3">每周三</span>
                                                                <span v-if="item.unit.week == 4">每周四</span>
                                                                <span v-if="item.unit.week == 5">每周五</span>
                                                                <span v-if="item.unit.week == 6">每周六</span>
                                                                <span v-if="item.unit.week == 0">每周天</span>
                                                            </div>
                                                            <div v-if="item.unit.cycle == 2">{{timeDate(item.unit.date)}}</div>
                                                        </div>
                                                        <div class="link_box_tlogic_timefor_del" @click="linkTimeDel(index)">x</div>
                                                    </div>
                                                    
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="link_box_tlogic_conflex">
                                        <div class="link_box_start" style="margin-bottom: 0px;">触发动作</div>
                                        <div class="link_box_logic_control_bottom">
                                            <div class="link_box_tlogic_add">
                                                <p class="link_box_tlogic_add_p" @click="getlinkLogicadd(0)">
                                                    <i class="el-icon-circle-plus-outline"></i> 
                                                </p>
                                            </div>
                                            <div class="link_box_logic_control" style="width: 90%;">
                                                <div class="link_box_logic_item" v-for="(item,index) in this.logicListAll " :key=index>
                                                    <div class="link_box_logic_item_left">
                                                        <div class="link_box_logic_contrlo_name" :title="item">
                                                            <p>{{ item.name }}</p>
                                                        </div>
                                                        <div class="link_box_logic_contrlo_div">
                                                            <div class="link_b_l_contrlo_t">间隔时间(s)</div>
                                                            <div>：</div>
                                                            <div class="link_b_l_contrlo_s">{{ item.time }}</div>
                                                        </div>
                                                    </div>
                                                    <div class="link_box_logic_edit">
                                                        <i class="el-icon-edit-outline" @click="getlinkLogicadd(1,item)"></i>
                                                        <i class="el-icon-delete linkList_but_delete" @click="getlinkDele(item)" title="删除"></i>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                </div>
                                <!-- 结束触发动作 -->
                                <div class="link_box_eoperate">
                                    <div class="link_box_end">触发动作</div>
                                    <div class="link_box_start_add">
                                        <div class="link_box_tlogic_add">
                                            <p class="link_box_tlogic_add_p" @click="getlinkgroup(0,'end')">
                                                <i class="el-icon-circle-plus-outline"></i> 
                                            </p>
                                        </div>
                                        <div class="link_box_logic_control">
                                            <vuedraggable v-model="end">
                                                <div class="link_box_logic_control_item" v-for="item in end " :key="item.uid">
                                                    <div class="link_box_logic_control_name" :title="item.name">{{item.name}}</div>
                                                    <div class="link_box_logic_control_flex">
                                                        <div class="link_box_logic_edit">
                                                            <p><i class="el-icon-edit-outline" @click="getlinkgroup(1,item,'end')" title="编辑"></i></p>
                                                            <p><i class="el-icon-delete" @click="getlinkgroupDele('end',item)" title="删除"></i></p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </vuedraggable>
                                        </div>
                                    </div>
                                    
                                </div>
                            </div>
                        </div>
                    </div>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="linkSave(0)">取 消</el-button>
                <el-button type="primary" @click="linkSave(1)">确 定</el-button>
            </span>
        </el-dialog>       
        <!-- 联动时间段内触发内容设置 -->
        <el-dialog
            :title="this.linkLogicTitle"
            :visible.sync="linkLogic"
            width="70%"
            class="dialog_link"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            :append-to-body="true">
            <div class="link_t_div">
                <div class="link_t_div_alert" v-if="this.linkLogicNameL">
                    <div class="link_t_div_alert_w">
                        <el-alert
                            title="描述文字包含触发条件与执行项，例如：“ 采集1号房间室内温度控制1号房间空调开关机 ”。"
                            type="warning"
                            center
                            :closable="false"
                        >
                        </el-alert>
                        <div class="link_t_div_alert_x" @click="linkLogicNameL = false">x</div>
                    </div>
                </div>
                <div class="link_item_name">
                    <el-form :model="logicList">
                        <el-form-item label="名称:" label-width="67px">
                            <el-input v-model="logicList.name" autocomplete="off"></el-input>
                        </el-form-item>
                    </el-form>
                    <i class="el-icon-question" @click="linkLogicNameL = true"></i>
                </div>
                <!-- 关联项 -->
                <div class="link_item">
                    <el-form :model="logicList" class="link_itemgl">
                        <el-form-item label="关联方式:" label-width="75px">
                            <el-radio v-model="logicList.mode" label="0">所有项满足触发</el-radio>
                            <el-radio v-model="logicList.mode" label="1">任一项满足触发</el-radio>
                        </el-form-item>
                    </el-form>
                    <div class="link_adddiv">
                        <p class="link_time_title">触发条件添加：</p>
                        <div class="link_add" @click="getlinkitem(0)">
                            <i class="el-icon-circle-plus-outline"></i> 
                        </div>
                        <div class="link_adddiv_time">
                            <el-form :model="logicList">
                                <el-form-item label="重复触发间隔时间(s):" label-width="150px">
                                    <el-input v-model="logicList.time" autocomplete="off" type="number"></el-input>
                                </el-form-item>
                            </el-form>
                            
                        </div>
                    </div>
                    <div class="link_item_div">
                        <el-table
                            :key="this.tabkeya"
                            height="375"
                            :data="logicList.valueList"
                            style="width: 100%">
                            <el-table-column
                                label="类型名称">
                                <template slot-scope="scope">
                                    <span>
                                        {{scope.row.valueName.substring((scope.row.valueName.substring(0,scope.row.valueName.indexOf("/"))).length+1,scope.row.valueName.length)}}
                                    </span>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="high"
                                label="触发门限"
                                align="center"
                                width="80">
                            </el-table-column>
                            <el-table-column
                                prop="low"
                                label="恢复门限"
                                align="center"
                                width="80">
                            </el-table-column>
                            <el-table-column
                                prop="delay"
                                label="延迟保持(s)"
                                align="center"
                                width="100">
                            </el-table-column>
                            <el-table-column
                                label="操作"
                                align="center"
                                width="100">
                                <template slot-scope="scope">
                                    <el-button class="linktable" @click="getlinkitem(1,scope.row)" type="text" size="small">
                                        <i class="el-icon-edit-outline" title="编辑"></i>
                                    </el-button>
                                    <el-button class="linktable" @click="getlinkitemDele(scope.row)" type="text" size="small">
                                        <i class="el-icon-delete linkList_but_delete" title="删除"></i>
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
                <div class="link_line">
                    <div>
                        <p class="link_line_j1" style="margin-bottom:160px">→</p>
                        <p class="link_line_j1">→</p>
                        <p class="link_line_j2">触发</p>
                        <p class="link_line_j2">↓</p>
                    </div>
                </div>
                <!-- 触发控制项 -->
                <div class="link_control">
                    <div class="link_adddiv">
                        <p class="link_time_title">触发门限后动作输出：</p>
                        <div class="link_add" @click="getlinkgroup(0,'controlListHigh')">
                            <i class="el-icon-circle-plus-outline"></i> 
                        </div>
                    </div>
                    <div class="link_item_div">
                        <el-table
                            :data="logicList.controlListHigh"
                            height="185"
                            style="width: 100%">
                            <el-table-column
                                label="排序"
                                align="center"
                                width="80">
                                <template slot-scope="scope">
                                    <el-button
                                        size="mini"
                                        class="link_top"
                                        type="primary"
                                        icon="el-icon-bottom"
                                        :disabled="scope.$index === logicList.controlListHigh.length - 1"
                                        @click="moveDown(scope.$index, scope.row)"
                                    >
                                    </el-button>
                                    <el-button
                                        size="mini"
                                        type="primary"
                                        class="link_top"
                                        icon="el-icon-top"
                                        :disabled="scope.$index === 0"
                                        @click="moveUp(scope.$index, scope.row)"
                                    >
                                    </el-button>
                                </template>
                            </el-table-column>
                            <el-table-column
                                label="类型名称">
                                <template slot-scope="scope">
                                    <span>
                                        {{scope.row.valueName.substring((scope.row.valueName.substring(0,scope.row.valueName.indexOf("/"))).length+1,scope.row.valueName.length)}}
                                    </span>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="carryName"
                                align="center"
                                label="控制"
                                width="80">
                            </el-table-column>
                            <el-table-column
                                label="操作"
                                align="center"
                                width="100">
                                <template slot-scope="scope">
                                    <el-button class="linktable" @click="getlinkgroup(1,scope.row,'controlListHigh')" type="text" size="small">
                                        <i class="el-icon-edit-outline" title="编辑"></i>
                                    </el-button>
                                    <el-button class="linktable" @click="getlinkgroupDele('controlListHigh',scope.row)" type="text" size="small">
                                        <i class="el-icon-delete linkList_but_delete" title="删除"></i>
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <div class="link_adddiv" style="margin-top: 25px;">
                        <p class="link_time_title">恢复门限后动作输出：</p>
                        <div class="link_add" @click="getlinkgroup(0,'controlListLow')">
                            <i class="el-icon-circle-plus-outline"></i> 
                        </div>
                    </div>
                    <div class="link_item_div">
                        <el-table
                            :data="logicList.controlListLow"
                            height="185"
                            style="width: 100%">
                            <el-table-column
                                label="排序"
                                align="center"
                                width="80">
                                <template slot-scope="scope">
                                    <el-button
                                        size="mini"
                                        class="link_top"
                                        icon="el-icon-bottom"
                                        type="primary"
                                        :disabled="scope.$index === logicList.controlListLow.length - 1"
                                        @click="moveDown2(scope.$index, scope.row)"
                                    >
                                    </el-button>
                                    <el-button
                                        size="mini"
                                        class="link_top"
                                        icon="el-icon-top"
                                        type="primary"
                                        :disabled="scope.$index === 0"
                                        @click="moveUp2(scope.$index, scope.row)"
                                    >
                                    </el-button>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="valueName"
                                label="类型名称">
                                <template slot-scope="scope">
                                    <span>
                                        {{scope.row.valueName.substring((scope.row.valueName.substring(0,scope.row.valueName.indexOf("/"))).length+1,scope.row.valueName.length)}}
                                    </span>
                                </template>
                            </el-table-column>
                            <el-table-column
                                prop="carryName"
                                label="控制"
                                align="center"
                                width="80">
                            </el-table-column>
                            <el-table-column
                                label="操作"
                                align="center"
                                width="100">
                                <template slot-scope="scope">
                                    <el-button class="linktable" @click="getlinkgroup(1,scope.row,'controlListLow')" type="text" size="small">
                                        <i class="el-icon-edit-outline" title="编辑"></i>
                                    </el-button>
                                    <el-button class="linktable" @click="getlinkgroupDele('controlListLow',scope.row)" type="text" size="small">
                                        <i class="el-icon-delete linkList_but_delete" title="删除"></i>
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button  type="primary" @click="linkLogicSave(0)">取 消</el-button>
                <el-button type="primary" @click="linkLogicSave(1)">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 联动内容属性值选择设置 -->
        <el-dialog
            :title="this.linkItemTitle"
            :visible.sync="linkItem"
            width="40%"
            class="dialog_link"
            @close="closelinkitema"
            :close-on-click-modal="false"
            :append-to-body="true">
            <div class="group_dialog">
                <Cascaderitem 
                    ref="childa" 
                    :valueList="valueList" 
                    :itemlistData="itemlistData"
                    :linkItemTitle="linkItemTitle"
                    @childa="fatherMethoda"
                ></Cascaderitem>
                
            </div>
        </el-dialog>
        <!-- 联动内容分组控制选择设置 -->
        <el-dialog
            :title="this.linkGroupTitle"
            :visible.sync="linkGroup"
            width="40%"
            class="dialog_link"
            @close="closelinkitemb"
            :close-on-click-modal="false"
            :append-to-body="true">
            <div class="group_dialog">
                <Cascadercontrol 
                    ref="childb" 
                    :controlList="controlList" 
                    :itemlistData="itemlistData"
                    :linkGroupTitle="linkGroupTitle"
                    :type = "controlListType"
                    @childb="fatherMethodb"
                ></Cascadercontrol >
            </div>
        </el-dialog>
        <!-- 联动内容时间选择设置 -->
        <el-dialog
            :title="this.linkTimeTitle"
            :visible.sync="linkTime"
            width="40%"
            class="dialog_link"
            @close="cllinkTime"
            :close-on-click-modal="false"
            :append-to-body="true">
            <div class="group_dialog">
                <div class="link_box_tlogic_choose">
                    <el-radio v-model="linkTimeRadio" label="1">手动添加</el-radio>
                    <el-radio v-model="linkTimeRadio" label="2">选择时间模块</el-radio>
                </div>
                <div class="link_box_tlogic_item" v-if="this.linkTimeRadio == '1'">
                    <div class="time_title">
                        <div>周期选择：</div>
                        <div>时间范围：</div>
                    </div>
                    <div class="time_item_div">
                        <div class="time_item_div_flex">
                            <div class="time_zz_flex">
                                <el-cascader
                                    v-model="linkTimedata.cycleValue"
                                    :options="timeOptions"
                                    @change="timelinkChange()">
                                </el-cascader>
                            </div>
                            <div class="time_zz_flex">
                                <el-date-picker
                                    value-format="timestamp"
                                    v-model="linkTimedata.dateValue" class="time_date"
                                    @change="datelinkChangt()"
                                    type="date" v-show="linkTimedata.cycle == 2"
                                    placeholder="选择日期">
                                </el-date-picker>
                            </div>
                        </div>
                        <div class="time_item_div_flex">
                            <div class="time_zz_flex">
                                <el-time-select
                                    placeholder="起始时间"
                                    v-model="linkTimedata.start"
                                    @change="changeTimelink($event,'start')"
                                    :picker-options="{
                                        start: '00:00',
                                        step: '00:15',
                                        end: '24:00'
                                    }">
                                </el-time-select>
                            </div>
                            <div class="time_zz_flex">
                                <el-time-select
                                    placeholder="结束时间"
                                    v-model="linkTimedata.end"
                                    @change="changeTimelink($event,'end')"
                                    class="time_date"
                                    :picker-options="{
                                        start: '00:00',
                                        step: '00:15',
                                        end: '24:00',
                                        minTime: linkTimedata.start
                                    }">
                                </el-time-select>
                            </div>
                            
                        </div>
                    </div>
                </div>
                <el-form :model="timeslotListN"  v-if="this.linkTimeRadio == '2'">
                    <el-form-item label="请选择时间模块:" label-width="120px">
                        <el-select v-model="timeslotListN.id" placeholder="请选择">
                            <el-option
                            v-for="(item,index) in this.timeList"
                            :key="index"
                            :label="item.name"
                            :value="item.uid"
                            placeholder="请选择"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button   type="primary" @click="linktimeSave(0)">取 消</el-button>
                <el-button type="primary" @click="linktimeSave(1)">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 平均值模块设置 -->
        <el-dialog
            :title="this.meanBoxTitle"
            :visible.sync="meanBox"
            width="60%"
            class="dialog_link"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            :append-to-body="true">
            <div class="group_dialog">
                <el-form :model="meanListdata">
                    <el-form-item label="名称:" label-width="100px" class="meanBox_input">
                        <el-input v-model="meanListdata.name" autocomplete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="选择子项:" label-width="100px">
                        <el-cascader
                            ref="cascader"
                            v-model="cascaderMean"
                            :options="itemlistData"
                            :props="casProps"
                            clearable
                            placeholder="请添加对应子项"
                            @change="handleoChange"
                            >
                        </el-cascader>
                    </el-form-item>
                    <div  class="mean_flex">
                        <div class="meanflex">
                            <div class="meanflexBox" v-for="(item,index) in this.meanListdata.unit" :key="index" :title="item.moduleName +'/'+ item.devName +'/'+ item.idName">
                                <div class="meanflexBox_titile">{{item.moduleName}} / {{item.devName}} / {{item.idName}}</div>
                                <div class="meanflexBox_del" @click="meanDel(index)">x</div>
                            </div>
                        </div>
                    </div>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button  type="primary" @click="meanSave(0)">取 消</el-button>
                <el-button type="primary" @click="meanSave(1)">确 定</el-button>
            </span>
            
        </el-dialog>
        <!-- 分组模块设置 -->
        <el-dialog
            :title="this.groupBoxTitle"
            :visible.sync="groupBox"
            width="60%"
            class="dialog_link"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            :append-to-body="true">
            <div class="meanBox group_dialog">
                <el-form :model="groupListdata">
                    <el-form-item label="名称:" label-width="120px" class="meanBox_input">
                        <el-input v-model="groupListdata.name" autocomplete="off"></el-input>
                    </el-form-item>
                    <div class="link_numput">
                        <el-form-item label="选择子项:" label-width="120px">
                            <el-cascader
                                ref="cascader"
                                v-model="cascaderMean"
                                :options="itemlistData"
                                :props="groupCasProps"
                                clearable
                                placeholder="请添加对应子项"
                                @change="itemChange"
                                @focus="itemFocus"
                                >
                            </el-cascader>
                        </el-form-item>
                    </div>
                    <div class="link_numput">
                        <el-form-item label="执行值:" label-width="120px">
                            <el-input v-model="groupValue2" :onKeyUp="groupValue2=groupValue2.replace(/[\W]/g,'')" :placeholder="groupCarryName+':'+groupValue" @change="getValue" autocomplete="off"></el-input>
                        </el-form-item>
                        <div class="linkcontrol_help" v-if="this.dictionary.length != 0">
                            <el-button type="primary" @click="linkDictionary = true">帮助</el-button>
                        </div>
                        <el-button class="group_valueclass" type="primary" @click="groupChange(cascaderMean)">添加</el-button>
                    </div>
                    
                    <div  class="mean_flex">
                        <div class="meanflex">
                            <div class="meanflexBox" v-for="(item,index) in this.groupListdata.unit" :key="index" :title="item.moduleName +'/'+ item.devName +'/'+ item.idName +':'+ item.value">
                                <div class="meanflexBox_titile">{{item.moduleName}} / {{item.devName}} / {{item.idName}}:{{item.carryName}}</div>
                                <div class="meanflexBox_del" @click="groupDel(index)">x</div>
                            </div>
                        </div>
                    </div>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button  type="primary" @click="groupSave(0)">取 消</el-button>
                <el-button type="primary"  @click="groupSave(1)">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 字典弹窗 -->
        <el-dialog
            title="帮助字典"
            :visible.sync="linkDictionary"
            width="30%"
            class="dialog_link"
            :append-to-body="true">
            <div class="meanBox group_dialog">
                <el-form :model="controlList">
                    <el-form-item label="建议执行控制:" label-width="110px" >
                        <el-select v-model="groupContral" @change="getSelect" placeholder="自定义">
                            <el-option
                            v-for="item in dictionary"
                            :key="item.value"
                            :label="item.label+item.value"
                            :value="item.value"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
            </div>
        </el-dialog>
        <!-- 时间模块设置 -->
        <el-dialog
            :title="this.timeBoxTitle"
            :visible.sync="timeBox"
            :show-close="false"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            width="70%"
            class="dialog_link"
            @closed="timeSave(0)"
            :append-to-body="true">
            <div class="meanBox group_dialog">
                <el-form >
                    <el-form-item label="名称:" label-width="120px" class="meanBox_input">
                        <el-input v-model="timeListdata.name" :disabled="linkList ? true :false" autocomplete="off"></el-input>
                    </el-form-item>
                    <el-form-item label="添加时间:" label-width="120px"  :style="linkList ? 'display:none' :'display:block'">
                        <p class="time_add">
                            <i class="el-icon-circle-plus-outline"  @click="addTime()"></i> 
                        </p>
                    </el-form-item>
                    <div  class="mean_flex">
                        <div class="meanflex">
                            <div class="time_item" v-for="(item,index) in this.timeListdataWeb.unit" :key="index">
                                <div class="time_title">
                                    <div>周期选择：</div>
                                    <div>时间范围：</div>
                                </div>
                                <div class="time_item_div">
                                    <div class="time_item_div_flex">
                                        <div class="time_zz_flex">
                                            <el-cascader
                                                v-model="item.cycleValue"
                                                :options="timeOptions"
                                                :disabled="linkList ? true :false"
                                                @change="timeChange(index,item)">
                                            </el-cascader>
                                        </div>
                                        <div class="time_zz_flex">
                                            <el-date-picker
                                                value-format="timestamp"
                                                v-model="item.dateValue" class="time_date"
                                                @change="dateChangt(index,item)"
                                                type="date" v-show="timeListdata.unit[index].cycle == 2"
                                                :disabled="linkList ? true :false"
                                                placeholder="选择日期">
                                            </el-date-picker>
                                        </div>
                                    </div>
                                    <div class="time_item_div_flex">
                                        <div class="time_zz_flex">
                                            <el-time-select
                                                placeholder="起始时间"
                                                v-model="item.start"
                                                :disabled="linkList ? true :false"
                                                @change="changeTime($event,'start',index)"
                                                :picker-options="{
                                                    start: '00:00',
                                                    step: '00:15',
                                                    end: '24:00'
                                                }">
                                            </el-time-select>
                                        </div>
                                        <div class="time_zz_flex">
                                            <el-time-select
                                                placeholder="结束时间"
                                                v-model="item.end"
                                                :disabled="linkList ? true :false"
                                                @change="changeTime($event,'end',index)"
                                                class="time_date"
                                                :picker-options="{
                                                    start: '00:00',
                                                    step: '00:15',
                                                    end: '24:00',
                                                    minTime: item.start
                                                }">
                                            </el-time-select>
                                        </div>
                                        
                                    </div>
                                </div>
                                <div class="time_item_dele" :style="linkList ? 'display:none' :'display:block'">
                                    <p class="time_del">
                                        <i class="el-icon-document-copy" title="复制" @click="timeCopy(index)"></i> 
                                        <i class="el-icon-circle-close" title="删除"  @click="timeDel(index)" style="margin-left:10px"></i> 
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                </el-form>
            </div>
            <span v-if="linkList ? true :false" slot="footer" class="dialog-footer">
                <el-button  type="primary" @click="timeBox = false">取 消</el-button>
            </span>
            <span v-if="linkList ? false :true" slot="footer" class="dialog-footer">
                <el-button  type="primary" @click="timeSave(0)">取 消</el-button>
                <el-button type="primary" @click="timeSave(1)">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import Cascaderitem from "./link/itemAdd.vue";
import Cascadercontrol from "./link/controlAdd.vue";
import Vuedraggable from 'vuedraggable';
import dictionaryData from "../../../static/dictionary.json"
import configSet from "./link/configSet.vue";
import Infrared from "../set/Infrared.vue";
export default {
    name:'linkage',
    components: {
        Cascaderitem,Cascadercontrol,Vuedraggable,configSet,Infrared
    },
    data() {
        return {
            loading:false,//加载
            allData:{},
            listLocal:[],
            list:[],
            timeListFixed:'',//接口方法的定时器
            boxor:true,
            timeGetData: '',//循环获取是否下发成功的循环参数
            dictionary:[],//字典
            listData:[
                {
                    backName:'空调',
                    type:'ac',
                    activity:0
                },
                {
                    backName:'通用模块',
                    type:"normal",
                    activity:0
                },
                {
                    backName:'温湿度(外置)',
                    type:"temp",
                    activity:0
                },
                {
                    backName:'空开监测',
                    type:'xtg401',
                    activity:0
                },
                {
                    backName:'输出控制',
                    type:'xtg402',
                    activity:0
                },               
                {
                    backName:'干接点监测',
                    type:'xtg403',
                    activity:0
                },
                {
                    backName:'云测仪',
                    type:'k8s',
                    activity:0
                },
                {
                    backName:'恒湿机',
                    type:'humi',
                    activity:0
                },
                {
                    backName:'除湿机',
                    type:"humiless",
                    activity:0
                },
                {
                    backName:'加湿机',
                    type:"humiadd",
                    activity:0
                },
                {
                    backName:'除酸机',
                    type:"deac",
                    activity:0
                },
                {
                    backName:'霉菌机',
                    type:'airclean',
                    activity:0
                },
                {
                    backName:'新风机',
                    type:'airfilter',
                    activity:0
                },               
                {
                    backName:'驱鼠器',
                    type:'mouse',
                    activity:0
                },
                {
                    backName:'净化整理台',
                    type:'cleantable',
                    activity:0
                },
                {
                    backName:'净化柜',
                    type:'cleanbox',
                    activity:0
                },
                {
                    backName:'整理台',
                    type:'table',
                    activity:0
                },
                {
                    backName:'新风机(TY)',
                    type:"filterlite",
                    activity:0
                },
                {
                    backName:'洁净机',
                    type:"airlite",
                    activity:0
                },
                {
                    backName:'空调遥控器',
                    type:"irf818",
                    activity:0
                },
                {
                    backName:'空气监测(外置)',
                    type:"k8s_501",
                    activity:0
                },
                {
                    type:'mode',
                    backName:'平均值模块'
                },{
                    type:'group',
                    backName:'控制模块',
                    activity:0
                }
            ],
            itemlistData:[],//设备总列表
            linkList:false,//关联列表编辑
            linkTitle:'',
            linkListData:{},
            timeslotList:[],
            timeslotListN:{},
            tabkeya:0,//重新渲染表格
            valueList:{}, //关联列表属性值表单
            logicListAll:[], //关联列表时间段内触发属性数组
            logicList:{},//关联列表时间段内触发属性临时对象
            start:[],//开始时间触发动作
            end:[],//结束时间触发动作
            controlList:{}, //关联列表分组控制表单
            controlListType:'',//触发动作在哪一操作类型中
            groupzList:[],
            linkLogic:false,//联动触发逻辑设置
            linkLogicTitle:'',
            linkLogicNameL:false,
            linkItem:false,//关联列表属性值选择
            linkItemTitle:'',
            linkGroup:false,//关联列表分组控制选择
            linkGroupTitle:'',
            linkDictionary:false,//字典帮助弹框
            linkTime:false,//关联列表时间选择弹框
            linkTimeTitle:'',
            linkTimeRadio:'1',//时间添加方式
            linkTimedata:{//时间设置数组
                cycle:0,
                cycleValue:[],//周期级联选择器内容 仅前端页面需要
                start:'',//仅前端页面需要
                end:'',//仅前端页面需要
                startTime:0,
                endTime:0,
                week:0,//0周一 1周二 2周三 3周四 4周五 5周六 6周天
                dateValue:'',//日期 仅前端页面需要
                date:0
            },
            meanList:[], // 平均值模块
            meanListdata:{},//平均值模块实际储存数据
            meanBox:false,//平均值编辑弹框
            meanBoxTitle:'',
            cascaderMean:[],//平均值级联选择器清空
            casProps: {
                multiple: false, //多选
                value: 'value',
                label: 'label',
                addr: 'addr',
                // 懒加载
                lazy: true, // 必须为true
                lazyLoad:this.lazyLoad,
            },
            groupList:[], //分组模块
            groupBox:false,//分组编辑弹框
            groupBoxTitle:'',
            groupListdata:[],//分组模块实际储存数据
            groupCasProps: {
                multiple: false, //多选
                value: 'value',
                label: 'label',
                addr: 'addr',
                // 懒加载
                lazy: true, // 必须为true
                lazyLoad:this.lazyLoad,
            },
            addr:0,//当前选中地址
            timeSysData:'',//接口方法的定时器
            groupValue:'',
            groupValue2:'',
            groupContral:'',
            groupCarryName:'',
            timeList:[],//时间模块
            timeListNum:0,//时间模块当前编辑的标号
            timeListdata:{},//时间模块实际储存数据
            timeListdataWeb:{},//时间模块用于展示日期和时间格式的新建数组，个别属性参数值表现形式不一致，本质上等于timeListdata
            timeBox:false,//时间编辑弹框
            timeBoxTitle:'',//时间模块弹框标题
            timeOptions:[//时间模块时间选择数组
                {
                    value:'day',
                    label:'每天'
                },{
                    value:'week',
                    label:'每周',
                    children:[
                        {
                            value:'1',
                            label:'周一'
                        },{
                            value:'2',
                            label:'周二'
                        },{
                            value:'3',
                            label:'周三'
                        },{
                            value:'4',
                            label:'周四'
                        },{
                            value:'5',
                            label:'周五'
                        },{
                            value:'6',
                            label:'周六'
                        },{
                            value:'0',
                            label:'周日'
                        },
                    ]
                },{
                    value:'date',
                    label:'日期'
                }
            ],
            airlimit:{//空气质量
                'dustlimit1': 0,
                'dustlimit2': 0,
                'pollutelimit1': 0,
                'pollutelimit2': 0
            }
        }
    },
    created() {
      this.getData();
      this.getairlimit();
    },
    methods: {
        //空气质量获取
        getairlimit(){
            this.$http
            .post(this.$baseUrl, {
                "getairlimit":"",
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            })
            .then((res) => {
                if(res.data.result == 'ok'){
                    this.airlimit = res.data.getairlimit
                }
                
            })
        },
        //接口获取
        getData(){
            // this.allData = linkDataJson
            this.loading = true
            this.$http
            .post(this.$baseUrl, {
                "getlayout":"layout8",
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            })
            .then((res) => {
                this.loading = false
                if(res.data.layout8 == "-" || res.data.layout8 == '' || res.data.layout8 == "{}"){
                    var data ={
                        "list":[],
                        "meanList":[],
                        "groupList":[],
                        "timeList":[]
                    } 
                    var params2 = {
                        "setlayout":"layout8",
                        "layout":JSON.stringify(data),
                        [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                    };
                    this.$http.post(this.$baseUrl, params2).then((res) => {
                        if(res.data.result == 'ok'){
                            this.getData();
                        }
                    });
                }else{
                    this.allData = JSON.parse(res.data.layout8)
                    console.log('获取：')
                    console.log(this.allData)
                    this.list = this.allData['list'] //关联块
                    localStorage.setItem("linkList", JSON.stringify(this.list));
                    this.listLocal = JSON.parse(localStorage.getItem("linkList"));
                    this.meanList = this.allData['meanList'] //平均值模块
                    this.timeList = this.allData['timeList'] //时间模块
                    this.groupList = this.allData['groupList'] //平均值模块
                    for(var i = 0; i < this.list.length; i++){
                        this.list[i].activity = this.list[i].activity == 0 ? false : true 
                        this.listLocal[i].activity = this.listLocal[i].activity == 0 ? false : true 
                    }
                }
            });
        },
        //保存下发
        setData(){
            this.loading = true
            var data = []
            data = this.allData
            for(var i = 0; i < data['list'].length; i++){
                data['list'][i].activity = data['list'][i].activity == false ? 0 : 1 
            }
            var params2 = {
                    "setlayout":"layout8",
                    "layout":JSON.stringify(data),
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            console.log('下发：')
            console.log(data)
            this.$http.post(this.$baseUrl, params2).then((res) => {
                if(res.data.result == 'ok'){
                    this.getData();
                    this.boxor = true
                }else{
                    this.$notify({
                        title: '修改失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                    this.boxor = false
                }
            });
        },
        airlimitSave(){
            var params = {
                "setairlimit":{
                    'dustlimit1':Number(this.airlimit.dustlimit1),
                    'dustlimit2':Number(this.airlimit.dustlimit2),
                    'pollutelimit1':Number(this.airlimit.pollutelimit1),
                    'pollutelimit2':Number(this.airlimit.pollutelimit2)
                },
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    this.$notify({
                        title: '修改成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '修改失败',
                        type: 'warning',
                        duration: 1500
                    });
                }
        
            })
        },
        //获取设备列表 val:  mode表示关联项列表展示  group表示控制项列表展示  list表示平均值模块、分组模块内设置展示的列表
        getlist(val){ 
            this.itemlistData=[]
            this.$http.post(this.$baseUrl,{
                "getdevlink":"",
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }).then((res) => {
                if(res.data.getdevlink == undefined){
                    // 停止循环接口
                    clearInterval(this.timeListFixed);
                    this.timeListFixed = null;
                    this.$nextTick(() => {
                        this.timeListFixed = setInterval(() => {
                            this.getlist(val)
                        }, 3000); 
                    })
                }else{
                    // 停止循环接口
                    clearInterval(this.timeListFixed);
                    this.timeListFixed = null;
                    let allList = res.data.getdevlink
                    var arr = []
                    // 设备列表刷新
                    for(var a = 0; a < allList.length; a++){
                        if(allList[a].devlink.length != 0){
                            var z = {
                                value:allList[a].type,
                                label:allList[a].typename,
                                children:[]
                            }
                            for(var b = 0; b < allList[a].devlink.length; b++){
                                var y = {
                                    value:allList[a].devlink[b].uid,
                                    label:allList[a].devlink[b].name,
                                    addr:allList[a].devlink[b].addr,
                                    moduleName:allList[a].typename,
                                    moduleType:allList[a].type.toString(),
                                    children:[]
                                }
                                z.children.push(y)
                            }
                            arr.push(z)
                        }
                    }
                    this.itemlistData = arr
                    // 平均值模块内容加入
                    if(val == 'mode' && this.meanList.length > 0 ){
                        var modearr = []
                        for(var b = 0; b < this.meanList.length; b++){
                            var nn = {
                                value:this.meanList[b].uid,
                                label:this.meanList[b].name,
                            }
                            modearr.push(nn)
                        }
                        var modedata = {
                            value:'mode',
                            label:'平均值模块',
                            children:modearr
                        }
                        this.itemlistData.push(modedata)
                    }
                    if(val == 'group' && this.groupList.length > 0 ){
                        var modearr = []
                        for(var b = 0; b < this.groupList.length; b++){
                            var nn = {
                                value:this.groupList[b].uid,
                                label:this.groupList[b].name,
                            }
                            modearr.push(nn)
                        }
                        var modedata = {
                            value:'group',
                            label:'控制模块',
                            children:modearr
                        }
                        this.itemlistData.push(modedata)
                    }
                }
            })
        },
        // 新建/编辑关联列表内容
        getlinklist(type,data){
            this.linkList = true
            if(type == 0){
                this.linkTitle = '新建'
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.list.length; i++){
                    if(this.list[i].id == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.linkListData = {
                    id:num,//唯一编号
                    activity:true,//使能
                    name:'',
                    timeslotList:[],
                    start:[],
                    end:[],
                    center:[]
                }
                this.logicList.valueList = []
                this.logicList.controlListLow = []
                this.logicList.controlListHigh = []
                this.start = []
                this.end = []
                this.logicListAll = [] 
                this.timeslotList = []
            }else if(type == 1){
                this.linkTitle = '编辑'
                this.linkListData = data
                this.logicListAll = data.center//
                this.start = data.start
                this.end = data.end
                this.timeslotList = []//时间数组中添加重复时间段属性，并判断
                for(var y = 0; y < data.timeslotList.length; y++){
                    var arr = {
                        'id':data.timeslotList[y].id,
                        'name':data.timeslotList[y].name,
                        'uid':data.timeslotList[y].uid,
                        'unit':data.timeslotList[y].unit,
                        'repeat':0,//是否重复，0不重复，1重复
                    }
                    this.timeslotList.push(arr)
                }
                this.getRepeat()
            }
        },
        //时间段重复判断
        getRepeat(){
            var list = [] // 直接添加的时间点
            var list2 = [] // 添加的时间模块 及模块中所包含的全部时间点
            var date = ''
            var week = 0
            //整理数据，生成上面两个数组
            for(var i = 0; i < this.timeslotList.length; i++){
                if(this.timeslotList[i].unit == undefined){
                    var arr = {
                        id:this.timeslotList[i].id,
                        name:this.timeslotList[i].name,
                        repeat:this.timeslotList[i].repeat,
                        uid:this.timeslotList[i].uid,
                        unit:[],
                    }
                    list2.push(arr)
                    for(var y = 0; y < this.timeList.length; y++){
                        if(this.timeslotList[i].id == this.timeList[y].uid){ // 找到该时间模块的具体内容
                            list2[list2.length-1].unit = this.timeList[y].unit
                        }
                    }
                }else{
                    list.push(this.timeslotList[i])
                }
            }
            //直接添加的时间点重复判断
            for(var a = 0; a < list.length; a++){
                var adata = list[a].unit
                var numb = 0;
                for(var b = 0; b < list.length; b++){ // 直接添加的时间点与直接添加的时间点之间的重复判断
                    if( b != a){ // 判断不是当前数组自己和自己对比
                        var bcontrast = list[b].unit
                        if(adata.cycle == 0){ //a按天时
                            if(this.startendTime(adata.startTime,adata.endTime,bcontrast.startTime,bcontrast.endTime)==1){
                                list[a].repeat = 1 //发生重复
                                numb = 1
                            }
                        }else if(adata.cycle == 1 || adata.cycle == 2){ //a按周或按日期
                            if(bcontrast.cycle == 0){ //a按周或按日期 并且b按天
                                if(this.startendTime(adata.startTime,adata.endTime,bcontrast.startTime,bcontrast.endTime)==1){
                                    list[a].repeat = 1 //发生重复
                                    numb = 1
                                }
                            }
                            if(adata.cycle == 1){//a按周
                                if(bcontrast.cycle == 1 && adata.week == bcontrast.week){ //a按周 b也按周 并且与a在同一设定周
                                    if(this.startendTime(adata.startTime,adata.endTime,bcontrast.startTime,bcontrast.endTime)==1){
                                        list[a].repeat = 1 //发生重复
                                        numb = 1
                                    }
                                }
                            }else if(adata.cycle == 2){ //a按日期
                                date = this.formatDate(adata.date*1000, 'YYYY-MM-DD');  
                                week = 0; 
                                switch (new Date(date).getDay()) {
                                    case 0: // 0星期天
                                        week = 0; 
                                        break;
                                    case 1: // 1星期一
                                        week = 1;
                                        break;
                                    case 2:
                                        week = 2;
                                        break;
                                    case 3:
                                        week = 3;
                                        break;
                                    case 4:
                                        week = 4;
                                        break;
                                    case 5:
                                        week = 5;
                                        break;
                                    case 6:
                                        week = 6;
                                }
                                if(bcontrast.cycle == 1 && week == bcontrast.week){ //b按周的设定周 与 a按日期算的周几 是同一周
                                    if(this.startendTime(adata.startTime,adata.endTime,bcontrast.startTime,bcontrast.endTime)==1){
                                        list[a].repeat = 1 //发生重复
                                        numb = 1
                                    }
                                }
                            }
                        }
                    }
                }
                for(var c = 0; c < list2.length; c++){// 直接添加的时间点与添加的时间模块之间的重复判断
                    for(var d = 0; d < list2[c].unit.length; d++){
                        var dmodule = list2[c].unit[d]
                        if(adata.cycle == 0){ //a按天时
                            if(this.startendTime(adata.startTime,adata.endTime,dmodule.startTime,dmodule.endTime)==1){
                                list[a].repeat = 1 //发生重复
                                numb = 1
                            }
                        }else if(adata.cycle == 1 || adata.cycle == 2){ //a按周或按日期
                            if(dmodule.cycle == 0){ //a按周或按日期 并且b按天
                                if(this.startendTime(adata.startTime,adata.endTime,dmodule.startTime,dmodule.endTime)==1){
                                    list[a].repeat = 1 //发生重复
                                    numb = 1
                                }
                            }
                            if(adata.cycle == 1){//a按周
                                if(dmodule.cycle == 1 && adata.week == dmodule.week){ //a按周 b也按周 并且与a在同一设定周
                                    if(this.startendTime(adata.startTime,adata.endTime,dmodule.startTime,dmodule.endTime)==1){
                                        list[a].repeat = 1 //发生重复
                                        numb = 1
                                    }
                                }
                            }else if(adata.cycle == 2){ //a按日期
                                date = this.formatDate(adata.date*1000, 'YYYY-MM-DD');  
                                week = 0; 
                                switch (new Date(date).getDay()) {
                                    case 0: // 0星期天
                                        week = 0; 
                                        break;
                                    case 1: // 1星期一
                                        week = 1;
                                        break;
                                    case 2:
                                        week = 2;
                                        break;
                                    case 3:
                                        week = 3;
                                        break;
                                    case 4:
                                        week = 4;
                                        break;
                                    case 5:
                                        week = 5;
                                        break;
                                    case 6:
                                        week = 6;
                                }
                                if(dmodule.cycle == 1 && week == dmodule.week){ //b按周的设定周 与 a按日期算的周几 是同一周
                                    if(this.startendTime(adata.startTime,adata.endTime,dmodule.startTime,dmodule.endTime)==1){
                                        list[a].repeat = 1 //发生重复
                                        numb = 1
                                    }
                                }
                            }
                        }
                    }
                }
                if(numb == 0){
                    list[a].repeat = 0 //没有发生重复
                }
            }
            // 添加的时间模块重复判断
            for(var e = 0; e < list2.length; e++){
                var numc = 0;
                for(var f = 0; f < list2[e].unit.length; f++){ //时间重复判断 repeat属性赋值
                    var edata = list2[e].unit[f]
                    for(var g = 0; g < list.length; g++){ //添加的时间模块与直接添加的时间点之间的重复判断
                        var gcontrast = list[g].unit
                        if(edata.cycle == 0){ //e按天时
                            if(this.startendTime(edata.startTime,edata.endTime,gcontrast.startTime,gcontrast.endTime)==1){
                                list2[e].repeat = 1 //发生重复
                                numc = 1
                            }
                        }else if(edata.cycle == 1 || edata.cycle == 2){ //e按周或按日期
                            if(gcontrast.cycle == 0){ //a按周或按日期 并且b按天
                                if(this.startendTime(edata.startTime,edata.endTime,gcontrast.startTime,gcontrast.endTime)==1){
                                    list2[e].repeat = 1 //发生重复
                                    numc = 1
                                }
                            }
                            if(edata.cycle == 1){//a按周
                                if(gcontrast.cycle == 1 && edata.week == gcontrast.week){ //a按周 b也按周 并且与a在同一设定周
                                    if(this.startendTime(edata.startTime,edata.endTime,gcontrast.startTime,gcontrast.endTime)==1){
                                        list2[e].repeat = 1 //发生重复
                                        numc = 1
                                    }
                                }
                            }else if(edata.cycle == 2){ //a按日期
                                date = this.formatDate(edata.date*1000, 'YYYY-MM-DD');  
                                week = 0; 
                                switch (new Date(date).getDay()) {
                                    case 0: // 0星期天
                                        week = 0; 
                                        break;
                                    case 1: // 1星期一
                                        week = 1;
                                        break;
                                    case 2:
                                        week = 2;
                                        break;
                                    case 3:
                                        week = 3;
                                        break;
                                    case 4:
                                        week = 4;
                                        break;
                                    case 5:
                                        week = 5;
                                        break;
                                    case 6:
                                        week = 6;
                                }
                                if(gcontrast.cycle == 1 && week == gcontrast.week){ //b按周的设定周 与 a按日期算的周几 是同一周
                                    if(this.startendTime(edata.startTime,edata.endTime,gcontrast.startTime,gcontrast.endTime)==1){
                                        list2[e].repeat = 1 //发生重复
                                        numc = 1
                                    }
                                }
                            }
                        }
                    }
                    for(var h = 0; h < list2.length; h++){ //添加的时间模块与添加的时间模块之间的重复判断
                        if( e != h){
                            for(var j = 0; j < list2[h].unit.length; j++){
                                var jmodule = list2[h].unit[j]
                                if(edata.cycle == 0){ //a按天时
                                    if(this.startendTime(edata.startTime,edata.endTime,jmodule.startTime,jmodule.endTime)==1){
                                        list2[e].repeat = 1 //发生重复
                                        numc = 1
                                    }
                                }else if(edata.cycle == 1 || edata.cycle == 2){ //a按周或按日期
                                    if(jmodule.cycle == 0){ //a按周或按日期 并且b按天
                                        if(this.startendTime(edata.startTime,edata.endTime,jmodule.startTime,jmodule.endTime)==1){
                                            list2[e].repeat = 1 //发生重复
                                            numc = 1
                                        }
                                    }
                                    if(edata.cycle == 1){//a按周
                                        if(jmodule.cycle == 1 && edata.week == jmodule.week){ //a按周 b也按周 并且与a在同一设定周
                                            if(this.startendTime(edata.startTime,edata.endTime,jmodule.startTime,jmodule.endTime)==1){
                                                list2[e].repeat = 1 //发生重复
                                                numc = 1
                                            }
                                        }
                                    }else if(edata.cycle == 2){ //a按日期
                                        date = this.formatDate(edata.date*1000, 'YYYY-MM-DD');  
                                        week = 0; 
                                        switch (new Date(date).getDay()) {
                                            case 0: // 0星期天
                                                week = 0; 
                                                break;
                                            case 1: // 1星期一
                                                week = 1;
                                                break;
                                            case 2:
                                                week = 2;
                                                break;
                                            case 3:
                                                week = 3;
                                                break;
                                            case 4:
                                                week = 4;
                                                break;
                                            case 5:
                                                week = 5;
                                                break;
                                            case 6:
                                                week = 6;
                                        }
                                        if(jmodule.cycle == 1 && week == jmodule.week){ //b按周的设定周 与 a按日期算的周几 是同一周
                                            if(this.startendTime(edata.startTime,edata.endTime,jmodule.startTime,jmodule.endTime)==1){
                                                list2[e].repeat = 1 //发生重复
                                                numc = 1
                                            }
                                        }
                                    }  
                                }
                            }
                        }
                    }
                }
                if(numc == 0){
                    list2[e].repeat = 0 //没有发生重复
                }
                for(var k = 0; k < this.timeslotList.length; k++){//将判断完成的重复属性，传给原数组改变属性值
                    if(list2[e].uid ==  this.timeslotList[k].uid){
                        this.timeslotList[k].repeat = list2[e].repeat
                    }
                }
                
            }
        },
        //时间段重复判断
        startendTime(startTimea,endTimea,startTimeb,endTimeb){
            // a的开始时间 在b的开始与结束之间  或者a的结束时间 在b的开始与结束之间
            if(((startTimea > startTimeb) && (startTimea < endTimeb))
            || ((endTimea > startTimeb) && (endTimea < endTimeb))
            || ((startTimea < startTimeb) && (endTimea > endTimeb))
            || ((startTimea > startTimeb) && (endTimea < endTimeb))
            || ((startTimea == startTimeb) && (endTimea == endTimeb))
            ){
                var st = 1
                return st
            }
        },
        //删除  
        linklistDel(index,data){
            this.loading = true //等待动画
            this.list.splice(index,1)
            var params = {
                    "setlayout":"layout8",
                    "layout":{
                        'type':'delLinkModel',
                        "delLinkModel":{
                            'id':data.id
                        }
                    },
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    this.getData();
                    this.$notify({
                        title: '删除成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '删除失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                }
            });
            // this.setData();
        },
        //保存
        linkSave(index){
            if(index == 0){//关闭联动弹框
                this.linkList = false
                this.getData();
            }else if(index == 1){
                if(this.linkTitle == '新建'){
                    if(this.linkListData.name == ""){
                        this.$notify({
                            title: '名称未填写，请检查后保存',
                            type: 'warning',
                            duration: 1500
                        });
                        return false
                    }
                    this.linkList = false
                    this.list.push(this.linkListData)
                    this.list[this.list.length-1].center = this.logicListAll //时间段内触发动作
                    this.list[this.list.length-1].timeslotList = this.timeslotList //时间段保存
                    this.list[this.list.length-1].start = this.start //开始时间触发动作
                    this.list[this.list.length-1].end = this.end //结束时间触发动作
                    var params = {
                            "setlayout":"layout8",
                            "layout":{
                                'type':'addLinkModel',
                                "addLinkModel":this.linkListData
                            },
                            [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                    };
                    this.$http.post(this.$baseUrl, params).then((res) => {
                        if(res.data.result == 'ok'){
                            this.getData();
                            this.$notify({
                                title: '添加成功',
                                type: 'success',
                                duration: 1500
                            });
                        }else{
                            this.$notify({
                                title: '添加失败',
                                type: 'warning',
                                duration: 1500
                            });
                            this.loading = false
                        }
                    });
                }else if(this.linkTitle == '编辑'){
                    for(var i = 0; i < this.list.length; i++){
                        if(this.linkListData.id == this.list[i].id){
                            this.linkListData.start = this.start //拖拽顺序后的保存
                            this.linkListData.end = this.end
                            this.linkListData.center = this.logicListAll
                            this.linkListData.timeslotList = this.timeslotList
                            this.list[i] = this.linkListData
                        }
                    }
                    this.linkList = false
                    var params = {
                        "setlayout":"layout8",
                        "layout":{
                            'type':'updateLinkModel',
                            "updateLinkModel":this.linkListData
                        },
                        [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                    };
                    this.$http.post(this.$baseUrl, params).then((res) => {
                        if(res.data.result == 'ok'){
                            this.getData();
                            this.$notify({
                                title: '保存成功',
                                type: 'success',
                                duration: 1500
                            });
                        }else{
                            this.$notify({
                                title: '修改失败',
                                type: 'warning',
                                duration: 1500
                            });
                            this.loading = false
                        }
                    });
                }
            }
        },
        //关闭联动模块使能
        changeValue(index,data){
            this.loading = true //等待动画
            this.list[index].activity = data.activity ? true : false
            var params = {
                    "setlayout":"layout8",
                    "layout":{
                        'type':'linkenable',
                        "linkenable":{
                            "enable":data.activity ? 1 : 0, //1使能，0停止
                             "id":data.id
                            }
                    },
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            this.$http.post(this.$baseUrl, params).then((res) => {
                this.getData();
                if(res.data.result == 'ok'){
                    this.$notify({
                        title: '添加成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '添加失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                }
            });
            // this.setData()
        },
        // 时间段触发逻辑添加编辑弹框
        getlinkLogicadd(index,data){
            this.linkLogic = true
            this.logicList = {}
            if(index == 0){
                this.linkLogicTitle = '添加'
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.logicListAll.length; i++){
                    if(this.logicListAll[i].id == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.logicList = {
                    uid:num,
                    name:'',
                    time:0,
                    mode:'0',
                    valueList:[],
                    controlListLow:[],
                    controlListHigh:[]
                }
            }else if(index == 1){
                this.linkLogicTitle = '编辑'
                data.mode = data.mode.toString()
                // 恢复门限
                for(var y = 0; y < data.controlListLow.length; y++){
                    if(data.controlListLow[y].type == "group"){
                        for(var i = 0; i < this.groupList.length; i++){
                            if(this.groupList[i].uid == data.controlListLow[y].id){
                                data.controlListLow[y].valueName = '控制模块/'+this.groupList[i].name
                            }
                        }
                    }
                }
                // 触发门限
                for(var y = 0; y < data.controlListHigh.length; y++){
                    if(data.controlListHigh[y].type == "group"){
                        for(var i = 0; i < this.groupList.length; i++){
                            if(this.groupList[i].uid == data.controlListHigh[y].id){
                                data.controlListHigh[y].valueName = '控制模块/'+this.groupList[i].name
                            }
                        }
                    }
                }
                // 触发条件
                for(var y = 0; y < data.valueList.length; y++){
                    if(data.valueList[y].type == "mode"){
                        for(var i = 0; i < this.meanList.length; i++){
                            if(this.meanList[i].uid == data.valueList[y].id){
                                data.valueList[y].valueName = '平均值模块/'+this.meanList[i].name
                            }
                        }
                    }
                }
                this.logicList = data
                localStorage.setItem("logicListAll", JSON.stringify(this.logicListAll));
            }
        },
        linkTimerepeat(data){
            if(data.repeat == 1){
                this.$notify({
                    title: '监测到该时间段与其他设置时间段产生重叠，请注意检查',
                    type: 'warning',
                    duration: 3000
                });
            }
        },
        // 时间段触发保存
        linkLogicSave(index){
            if(index == 0){//取消
                if(this.linkLogicTitle == '编辑'){
                    this.logicListAll = JSON.parse(localStorage.getItem("logicListAll"));
                }
                this.linkLogic = false
            }else if(index == 1){//保存
                if(this.logicList.name == ''){
                    this.$notify({
                        title: '名称未填写',
                        type: 'warning',
                        duration: 1500
                    });
                    return false
                }else{
                    this.logicList.mode = Number(this.logicList.mode)
                    this.logicList.time = Number(this.logicList.time)
                    if(this.logicList.time < 300 && this.logicList.time != 0){
                        this.$notify({
                            title: '重复触发间隔时间不能小于5分钟',
                            type: 'warning',
                            duration: 1500
                        });
                        return false;
                    }
                    this.linkLogic = false
                    if(this.linkLogicTitle == '添加'){
                        this.logicListAll.push(this.logicList)
                    }else if(this.linkLogicTitle == '编辑'){
                        for(var i = 0; i < this.logicListAll.length; i++){
                            if(this.logicList.uid == this.logicListAll[i].uid){
                                this.logicListAll[i] = this.logicList
                            }
                        }
                    }
                }
            }
        },
        //打开添加、编辑关联属性值子项弹框
        getlinkitem(index,data){
            this.linkItem = true
            this.getlist('mode');//获取关联项设备列表
            if(index == 0){
                this.linkItemTitle = '添加'
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.logicList.valueList.length; i++){
                    if(this.logicList.valueList[i].uid == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.valueList={ //关联列表属性值表单
                    "uid":num,//唯一编号
                    "moduleType":"",//custom自定义类型 原type
                    "devType":"",//设备类型 新定义type数字值（平均值，控制模块无效）
                    "moduleName":"",//类型名称 原typeName
                    "devUid":0,//设备编号 自定义类型下该属性无意义 原serial
                    "devAddr":0,//设备地址
                    "devName":"",//设备名称 自定义类型下类型名称 原serialName
                    "id":0,//子项id  自定义类型下该属性为当前模块组唯一编号
                    "idName":"",//子项名称 自定义类型下该属性为当前模块组自定义名称
                    "delay":0,//延迟触发
                    "low":0,//下限
                    "high":0,//上限
                    "valueName":'请选择'//级联选择器展示文字
                }

            }else if(index == 1){
                this.linkItemTitle = '编辑'
                this.valueList = data
                localStorage.setItem("valueList", JSON.stringify(data));
            }
            
        },
        getlinkDele(data){
            for(var i = 0; i < this.logicListAll.length; i++){
                if(data.uid == this.logicListAll[i].uid){
                    this.logicListAll.splice(i,1)
                }
            }
        },
        // 删除关联属性值子项
        getlinkitemDele(data){
            for(var y = 0; y < this.logicListAll[0].valueList.length; y++){
                if(this.logicListAll[0].valueList[y].uid == data.uid){
                    this.logicListAll[0].valueList.splice(y,1)
                }
            }
            
        },
        //关闭关联属性值子项弹框
        closelinkitema(){
            this.$refs.childa.$emit("getKeya") ;
        },
        // 关联属性值子组件保存回调父组件方法
        fatherMethoda(data){
            // console.log(data)
            this.linkItem = false
            if(this.linkItemTitle=='添加'){
                if(data[0]==0){
                }else if(data[0]==1){
                    for(var y = 0; y < this.meanList.length; y++){
                        if(this.meanList[y].uid == data[1].uid){
                            data[1].high = this.meanList[y].high
                            data[1].low = this.meanList[y].low
                        }
                    }
                    this.logicList.valueList.push(data[1])
                }
            }else if(this.linkItemTitle=='编辑'){
                var arr = {}
                if(data[0]==0){
                    arr = JSON.parse(localStorage.getItem("valueList"));
                }else if(data[0]==1){
                    arr = data[1]
                }
                for(var i = 0; i < this.logicList.valueList.length; i++){
                    if(this.logicList.valueList[i].uid == arr.uid ){
                        this.logicList.valueList[i] = arr
                    }
                }
                this.tabkeya++;// 重新渲染表格
            }
        },
        //打开添加、编辑关联分组控制子项弹框
        getlinkgroup(index,data,type){
            this.linkGroup = true
            this.getlist('group');//获取关联项设备列表
            if(index == 0){
                this.linkGroupTitle = '添加'
                this.controlListType = data
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                if(data == 'controlListLow'){
                    for(var i = 0; i < this.logicList.controlListLow.length; i++){
                        if(this.logicList.controlListLow[i].uid == num){
                            num = Math.ceil(Math.random()*9998+1) 
                            i = 0
                        }
                    }
                }else if(data == 'controlListHigh'){
                    for(var i = 0; i < this.logicList.controlListHigh.length; i++){
                        if(this.logicList.controlListHigh[i].uid == num){
                            num = Math.ceil(Math.random()*9998+1) 
                            i = 0
                        }
                    }
                }else if(data == 'start'){
                    for(var i = 0; i < this.start.length; i++){
                        if(this.start.uid == num){
                            num = Math.ceil(Math.random()*9998+1) 
                            i = 0
                        }
                    }
                }else if(data == 'end'){
                    for(var i = 0; i < this.end.length; i++){
                        if(this.end.uid == num){
                            num = Math.ceil(Math.random()*9998+1) 
                            i = 0
                        }
                    }
                }
                this.controlList={ //关联列表属性值表单
                    "uid":num,//唯一编号
                    "name":"",//自定义名称
                    "moduleType":"",//custom自定义类型 原type
                    "devType":"",//设备类型 新定义type数字值（平均值，控制模块无效）
                    "moduleName":"",//类型名称 原typeName
                    "devUid":0,//设备编号 自定义类型下该属性无意义 原serial
                    "devAddr":0,//设备地址
                    "devName":"",//设备名称 自定义类型下类型名称 原serialName
                    "id":0,//子项id  自定义类型下该属性为当前模块组唯一编号
                    "idName":"",//子项名称 自定义类型下该属性为当前模块组自定义名称
                    "valueName":'请选择',//级联选择器展示文字
                    "value":0,//操作下发值
                    "carryName":'0' //操作动作名
                }
                
            }else if(index == 1){
                this.linkGroupTitle = '编辑'
                if(data.type == "group"){
                    for(var i = 0; i < this.groupList.length; i++){
                        if(this.groupList[i].uid == data.id){
                            data.valueName = '控制模块/'+this.groupList[i].name
                        }
                    }
                }
                this.controlList = data
                localStorage.setItem("valueList", JSON.stringify(data));
                this.controlListType = type
                setTimeout(() => {
                    this.$refs.childb.$emit("getValue2") ;
                },100)
                
            } 
        },
        // 触发门限上移
        moveUp(index, row) {
            if (index > 0) {
                const upDate = this.logicList.controlListHigh[index - 1];
                this.logicList.controlListHigh.splice(index - 1, 1);
                this.logicList.controlListHigh.splice(index, 0, upDate);
            } else {
                alert("已经是第一条，不可上移");
            }
        },
        // 触发门限下移
        moveDown(index, row) {
            if (index + 1 === this.logicList.controlListHigh.length) {
                alert("已经是最后一条，不可下移");
            } else {
                const downDate = this.logicList.controlListHigh[index + 1];
                this.logicList.controlListHigh.splice(index + 1, 1);
                this.logicList.controlListHigh.splice(index, 0, downDate);
            }
        },
        // 恢复门限上移
        moveUp2(index, row) {
            if (index > 0) {
                const upDate = this.logicList.controlListLow[index - 1];
                this.logicList.controlListLow.splice(index - 1, 1);
                this.logicList.controlListLow.splice(index, 0, upDate);
            } else {
                alert("已经是第一条，不可上移");
            }
        },
        // 恢复门限下移
        moveDown2(index, row) {
            if (index + 1 === this.logicList.controlListLow.length) {
                alert("已经是最后一条，不可下移");
            } else {
                const downDate = this.logicList.controlListLow[index + 1];
                this.logicList.controlListLow.splice(index + 1, 1);
                this.logicList.controlListLow.splice(index, 0, downDate);
            }
        },
        // 删除关联分组控制子项
        getlinkgroupDele(type,data){
            if(type == 'start'){
                for(var i = 0; i < this.start.length; i++){
                    if(this.start[i].uid == data.uid){
                        this.start.splice(i,1)
                    }
                }
            }else if(type == 'end'){
                for(var i = 0; i < this.end.length; i++){
                    if(this.end[i].uid == data.uid){
                        this.end.splice(i,1)
                    }
                }
            }else if(type == 'controlListLow'){
                for(var i = 0; i < this.logicList.controlListLow.length; i++){
                    if(this.logicList.controlListLow[i].uid == data.uid){
                        this.logicList.controlListLow.splice(i,1)
                    }
                }
            }else if(type == 'controlListHigh'){
                for(var i = 0; i < this.logicList.controlListHigh.length; i++){
                    if(this.logicList.controlListHigh[i].uid == data.uid){
                        this.logicList.controlListHigh.splice(i,1)
                    }
                }
            }
            
        },
        // 关联分组控制子组件保存回调父组件方法
        fatherMethodb(data){
            // console.log(data)
            this.linkGroup = false
            if(data[0]==0){//取消保存
                var arr = JSON.parse(localStorage.getItem("valueList"));
                if(this.controlListType == 'controlListLow'){
                    for(var i = 0; i < this.logicList.controlListLow.length; i++){
                        if(this.logicList.controlListLow[i].uid == arr.uid){
                            this.logicList.controlListLow[i] = arr
                        }
                    }
                }else if(this.controlListType == 'controlListHigh'){
                    for(var i = 0; i < this.logicList.controlListHigh.length; i++){
                        if(this.logicList.controlListHigh[i].uid == arr.uid){
                            this.logicList.controlListHigh[i] = arr
                        }
                    }
                }else if(this.controlListType == 'start'){
                    for(var i = 0; i < this.start.length; i++){
                        if(this.start[i].uid == arr.uid){
                            this.start[i] = arr
                        }
                    }
                }else if(this.controlListType == 'end'){
                    for(var i = 0; i < this.end.length; i++){
                        if(this.end[i].uid == arr.uid){
                            this.end[i] = arr
                        }
                    }
                }
            }else if(data[0]==1){//保存
                var controlt={ //关联列表属性值表单 时间段内操作用
                    "uid":data[1].uid,//唯一编号
                    "moduleType":data[1].moduleType,//custom自定义类型
                    "devType":data[1].devType,//custom自定义类型
                    "moduleName":data[1].moduleName,//类型名称
                    "devUid":data[1].devUid,//设备编号 自定义类型下该属性无意义
                    "devAddr":data[1].devAddr,//设备地址
                    "devName":data[1].devName,//设备名称 自定义类型下类型名称
                    "id":data[1].id,//子项id  自定义类型下该属性为当前模块组唯一编号
                    "idName":data[1].idName,//子项名称 自定义类型下该属性为当前模块组自定义名称
                    "valueName":data[1].valueName,//级联选择器展示文字
                    "value":data[1].value.toString(),//操作下发值
                    "carryName":data[1].carryName //操作动作名
                }
                var controle={ //关联列表属性值表单  开始结束触发用
                    "uid":data[1].uid,//唯一编号
                    "name":data[1].name,//自定义名称  时间段内触发没有该属性
                    "moduleType":data[1].moduleType,//custom自定义类型
                    "devType":data[1].devType,//custom自定义类型
                    "moduleName":data[1].moduleName,//类型名称
                    "devUid":data[1].devUid,//设备编号 自定义类型下该属性无意义
                    "devAddr":data[1].devAddr,//设备地址
                    "devName":data[1].devName,//设备名称 自定义类型下类型名称
                    "id":data[1].id,//子项id  自定义类型下该属性为当前模块组唯一编号
                    "idName":data[1].idName,//子项名称 自定义类型下该属性为当前模块组自定义名称
                    "valueName":data[1].valueName,//级联选择器展示文字
                    "value":data[1].value.toString(),//操作下发值
                    "carryName":data[1].carryName //操作动作名
                }
                if(this.linkGroupTitle=='添加'){
                    if(this.controlListType == 'controlListLow'){
                        this.logicList.controlListLow.push(controlt)
                    }else if(this.controlListType == 'controlListHigh'){
                        this.logicList.controlListHigh.push(controlt)
                    }else if(this.controlListType == 'start'){
                        this.start.push(controle)
                    }else if(this.controlListType == 'end'){
                        this.end.push(controle)
                    }
                }else if(this.linkGroupTitle=='编辑'){
                    if(this.controlListType == 'controlListLow'){
                        for(var i = 0; i < this.logicList.controlListLow.length; i++){
                            if(this.logicList.controlListLow[i].uid == controlt.uid){
                                this.logicList.controlListLow[i] = controlt
                            }
                        }
                    }else if(this.controlListType == 'controlListHigh'){
                        for(var i = 0; i < this.logicList.controlListHigh.length; i++){
                            if(this.logicList.controlListHigh[i].uid == controlt.uid){
                                this.logicList.controlListHigh[i] = controlt
                            }
                        }
                    }else if(this.controlListType == 'start'){
                        for(var i = 0; i < this.start.length; i++){
                            if(this.start[i].uid == controle.uid){
                                this.start[i] = controle
                            }
                        }
                    }else if(this.controlListType == 'end'){
                        for(var i = 0; i < this.end.length; i++){
                            if(this.end[i].uid == controle.uid){
                                this.end[i] = controle
                            }
                        }
                    }
                }
            }
            this.controlListType = ''
        },
        //关闭关联分组控制子项弹框
        closelinkitemb(){
            this.$refs.childb.$emit("getKeyb") ;
        },
        
        //添加关联列表时间添加
        getlinkTime(){
            this.linkTime = true
            this.linkTimeTitle = '添加'
            // 生成唯一编号
            var num = Math.ceil(Math.random()*9998+1)
            for(var y = 0; y < this.timeslotList.length; y++){
                if(this.timeslotList[y].uid == num){
                    num = Math.ceil(Math.random()*9998+1)
                    y = 0
                }
            }
            this.timeslotListN={
                uid:num,
                id:'',
                name:'',
                unit:{}
            }
            for(var i = 0; i < this.timeList.length; i++){
                this.timeList[i].uid = this.timeList[i].uid.toString()
            }
        },
        //关闭添加关联列表时间弹框触发
        cllinkTime(){
            for(var i = 0; i < this.timeList.length; i++){
                this.timeList[i].uid = Number(this.timeList[i].uid) 
            }
        },
        //新逻辑添加关联列表时间
        timelinkChange(){
            if(this.linkTimedata.cycleValue[0]=='day'){
                this.linkTimedata.cycle = 0
            }else if(this.linkTimedata.cycleValue[0]=='week'){
                this.linkTimedata.cycle = 1
                this.linkTimedata.week = Number(this.linkTimedata.cycleValue[1])
            }else if(this.linkTimedata.cycleValue[0]=='date'){
                this.linkTimedata.cycle = 2
            }
        },
        //时间选择后触发
        changeTimelink(event,type){
            if(type == 'start'){//开始时间转换
                this.linkTimedata.startTime = this.timeConvert(event)
            }else if(type == 'end'){//结束时间转换
                this.linkTimedata.endTime = this.timeConvert(event)
            }
        },
        //日期选择后触发
        datelinkChangt(){
            this.linkTimedata.date = this.linkTimedata.dateValue/1000
        },
        //添加关联列表时间保存
        linktimeSave(index){
            if(index == 0){
                this.linkTime = false
                this.cllinkTime()
                this.linkTimedata={//时间设置数组
                    cycle:0,
                    cycleValue:[],//周期级联选择器内容 仅前端页面需要
                    start:'',//仅前端页面需要
                    end:'',//仅前端页面需要
                    startTime:0,
                    endTime:0,
                    week:0,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                    dateValue:'',//日期 仅前端页面需要
                    date:0
                }
            }else if(index == 1){
                if(this.linkTimeRadio == '1'){//手动自定义时间段
                    var arr = {
                        cycle:this.linkTimedata.cycle,// 0每天  1每周  2固定日期
                        startTime:this.linkTimedata.startTime,
                        endTime:this.linkTimedata.endTime,
                        week:this.linkTimedata.week,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                        date:this.linkTimedata.date,//日期
                    }
                    var s = 0
                    if(arr.endTime == ""){
                        arr.endTime = 0
                    }
                    if(arr.startTime == ""){
                        arr.startTime = 0
                    }
                    if(arr.cycle == 2 && arr.date == ""){
                        s++;
                    }
                    if(s > 0){
                        this.$notify({
                            title: '监测有日期未选择，请检查后保存',
                            type: 'warning',
                            duration: 1500
                        });
                        return false
                    }
                    this.timeslotListN.id = 0
                    this.timeslotListN.unit = arr
                    this.timeslotList.push(this.timeslotListN)
                }else if(this.linkTimeRadio == '2'){ //时间模块选择
                    if(this.timeslotListN.id == ''){
                        this.$notify({
                            title: '未选择时间模块',
                            type: 'warning',
                            duration: 1500
                        });
                        return false
                    }else{
                        console.log(this.timeslotListN)
                        for(var i = 0; i < this.timeslotList.length; i++){
                            if(this.timeslotList[i].id == this.timeslotListN.id){
                                this.$notify({
                                    title: '时间模块添加重复，请重新选择',
                                    type: 'warning',
                                    duration: 1500
                                });
                                return false
                            }
                        }
                        this.timeslotListN.id = Number(this.timeslotListN.id)
                        for(var y = 0; y < this.timeList.length; y++){
                            if(this.timeList[y].uid == this.timeslotListN.id){
                                this.timeslotListN.name = this.timeList[y].name
                            }
                        }
                        var str = {
                            id:this.timeslotListN.id,
                            name:this.timeslotListN.name,
                            repeat:this.timeslotListN.repeat,
                            uid:this.timeslotListN.uid
                        }
                        this.timeslotList.push(str)
                    }
                }
                // this.timeslotList.push(this.timeslotListN)
                this.getRepeat()
                this.linkTime = false
                this.cllinkTime()
                this.linkTimedata={//时间设置数组
                    cycle:0,
                    cycleValue:[],//周期级联选择器内容 仅前端页面需要
                    start:'',//仅前端页面需要
                    end:'',//仅前端页面需要
                    startTime:0,
                    endTime:0,
                    week:0,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                    dateValue:'',//日期 仅前端页面需要
                    date:0
                }
                
            }
        },
        //查看关联列表时间详情
        linkTimeLook(data){
            this.timeBox = true
            this.timeBoxTitle = '查看'
            for(var i = 0; i < this.timeList.length; i++){
                if(this.timeList[i].uid == data.id){
                    this.gettimeTab(1,this.timeList[i],i)
                }
            }
            
        },
        //删除关联列表时间块
        linkTimeDel(index){
            this.timeslotList.splice(index, 1)
            this.getRepeat()
            
        },
        // 添加平均值模块
        getmeanTab(type,data){
            this.getlist('list');//获取设备列表
            if(type == 0){
                this.meanBox = true
                this.meanBoxTitle = '添加'
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.meanList.length; i++){
                    if(this.meanList[i].uid == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.meanListdata={
                    "uid":num,//唯一编号
                    "name":"",
                    "unit":[]
                }
            }else if(type == 1){
                this.meanBoxTitle = '编辑'
                this.meanListdata = data
                var num = 0;
                for(var i = 0; i < this.listLocal.length; i++){
                    for(var y = 0; y < this.listLocal[i].center.length; y++){
                        for(var j = 0; j < this.listLocal[i].center[y].valueList.length; j++){
                            if(this.listLocal[i].center[y].valueList[j].id == data.uid){
                                num++;
                            }
                        }
                    }
                }
                if(num > 0){
                    this.$notify({
                        title: '该平均模块被联动功能引用中，请慎重编辑',
                        type: 'warning',
                        duration: 2000
                    });
                    setTimeout(() => {
                        this.meanBox = true
                    }, 2000);
                }else{
                    this.meanBox = true
                }
            }
        },
        // 删除平均值模块
        getmeanDel(index,data){
            var num = 0;
            for(var i = 0; i < this.listLocal.length; i++){
                for(var y = 0; y < this.listLocal[i].center.length; y++){
                    for(var j = 0; j < this.listLocal[i].center[y].valueList.length; j++){
                        if(this.listLocal[i].center[y].valueList[j].id == this.meanList[index].uid){
                            num++;
                        }
                    }
                }
            }
            if(num > 0){
                this.$notify({
                    title: '该平均模块被联动功能引用中，请勿删除',
                    type: 'warning',
                    duration: 2000
                });
                return false
            }
            this.loading = true //等待动画
            this.meanList.splice(index, 1)
            var params = {
                    "setlayout":"layout8",
                    "layout":{
                        'type':'delMeanModel',
                        "delMeanModel":{
                            'uid':data.uid
                        }
                    },
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    this.getData();
                    this.$notify({
                        title: '删除成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '删除失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                }
            });
        },
        // 平均值选择
        handleoChange(val){
            var labels = this.$refs["cascader"].getCheckedNodes()[0].pathLabels
            console.log(this.$refs["cascader"].getCheckedNodes()[0].data.addr)
            var unit = {
                devType:val[0],//设备类型，原type
                moduleName:labels[0],//设备类型名称，原typeName
                devUid:val[1],//编号，原serial
                devAddr:this.$refs["cascader"].getCheckedNodes()[0].data.addr,
                devName:labels[1],//设备名，原serialName
                id:val[2],
                idName:labels[2]
            }
            var ss = 0
            for(var i = 0; i < this.meanListdata.unit.length; i++){
                if((this.meanListdata.unit[i].devType == unit.devType)
                &&(this.meanListdata.unit[i].devUid == unit.devUid)
                &&(this.meanListdata.unit[i].devAddr == unit.devAddr)
                &&(this.meanListdata.unit[i].id == unit.id)
                ){
                    ss = 1
                    this.$notify({
                        title: '子项选择重复',
                        type: 'warning',
                        duration: 1500
                    });
                }
            }
            if(ss == 0){
                this.meanListdata.unit.push(unit)
            }
            this.cascaderMean = []
            this.getlist('list');//获取设备列表
            // this.$refs['cascader'].panel.clearCheckedNodes()
        },
        // 懒加载获取数据 
        lazyLoad(node,resolve){
            const level = node.level
            const type = node.path
            var unit = []
            let data
            data = unit
            data.forEach(item => {
                item.value = item.value
                item.label = item.label
                item.addr = item.addr
                //将相关值赋值到选择器上
                item.leaf = level >= 2
            }) 
            resolve(data)
            if (level >= 2) {
                this.addr = Number(node.data.addr)
                //接口获取
                this.$http
                .post(this.$baseUrl, {
                    "getdevinfo": [
                        {
                            "uid":type[1].toString(),
                            "type":Number(type[0]),
                            "addr":Number(node.data.addr)
                        }
                    ],
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                })
                .then((res) => {
                    if(res.data.getdevinfo[0].unit == undefined){
                        // 停止循环接口
                        clearInterval(this.timeSysData);
                        this.timeSysData = null;
                        this.$nextTick(() => {
                            this.timeSysData = setInterval(() => {
                                this.lazyLoad(node,resolve)
                            }, 3000); 
                        })
                    }else{
                        // 停止循环接口
                        clearInterval(this.timeSysData);
                        this.timeSysData = null;
                        var itemData = res.data.getdevinfo[0].unit
                        for(var b = 0; b < itemData.length; b++){
                            if(itemData[b].ready == 1){
                                var reg = ''
                                if(itemData[b].id <= 34){
                                    reg = '(reg'+(itemData[b].id+2)+')'
                                }else if(itemData[b].id >= 35 && itemData[b].id <= 50){
                                    reg = '(reg37bit'+(itemData[b].id-35)+')'
                                }else if(itemData[b].id >= 51 && itemData[b].id <= 66){
                                    reg = '(reg38bit'+(itemData[b].id-51)+')'
                                }else if(itemData[b].id >= 67 && itemData[b].id <= 82){
                                    reg = '(reg39bit'+(itemData[b].id-67)+')'
                                }
                                var arr = {
                                    value:itemData[b].id,
                                    label:itemData[b].name+reg,
                                    addr:res.data.getdevinfo[0].addr,
                                }
                                unit.push(arr)
                            }
                        }
                        data = unit
                        data.forEach(item => {
                            item.value = item.value
                            item.label = item.label
                            item.addr = item.addr
                            //将相关值赋值到选择器上
                            item.leaf = level >= 2
                        })
                        resolve(data)
                        // 新增对最后一级的下一级的处理
                        // 到最后一级的时候消除加载圈及禁止继续请求
                        if (level === 3) {
                            resolve(data)
                            return
                        }
                    }
                    
                })
            }
        },
        // 平均值删除
        meanDel(index){
            this.meanListdata.unit.splice(index, 1)
        },
        //平均值保存
        meanSave(index){
            if(index == 0){
                this.meanBox = false
                this.getData();
            }else if(index == 1){
                if(this.meanListdata.name == '' || this.meanListdata.unit.length == 0){
                    this.$notify({
                        title: '模块内容未填写全',
                        type: 'warning',
                        duration: 1500
                    });
                    return false
                }else{
                    if(this.meanBoxTitle == '添加'){
                        this.loading = true //等待动画
                        this.meanBox = false
                        this.meanList.push(this.meanListdata)
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'addMeanModel',
                                    "addMeanModel":this.meanListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '添加成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '添加失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }
                    if(this.meanBoxTitle == '编辑'){
                        for(var i = 0; i < this.meanList.length; i++){
                            if(this.meanList[i].uid == this.meanListdata.uid){
                                this.meanList[i] = this.meanListdata
                            }
                        }
                        this.loading = true //等待动画
                        this.meanBox = false
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'updateMeanModel',
                                    "updateMeanModel":this.meanListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '保存成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '修改失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }
                    // this.boxor = false
                    // this.setData();
                    // this.meanBox = false
                    // this.timeGetData = setInterval(() => {
                    //     if(this.boxor == true){
                    //         clearInterval(this.timeGetData);
                    //         this.timeGetData = null;
                    //         this.$notify({
                    //             title: '保存成功',
                    //             type: 'success',
                    //             duration: 1500
                    //         });
                    //     }
                    // }, 500); 
                }
                
            }
        },
        // 添加分组模块
        getgroupTab(type,data){
            this.getlist('list');//获取设备列表
            if(type == 0){
                this.groupBox = true
                this.groupBoxTitle = '添加'
                // 生成唯一编号
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.groupList.length; i++){
                    if(this.groupList[i].uid == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.groupListdata={
                    "uid":num,//唯一编号
                    "name":"",
                    "unit":[]
                }
            }else if(type == 1){
                this.groupBoxTitle = '编辑'
                this.groupListdata = data
                var num = 0;
                for(var i = 0; i < this.listLocal.length; i++){
                    for(var a = 0; a < this.listLocal[i].end.length; a++){
                        if(this.listLocal[i].end[a].id == data.uid){
                            num++;
                        }
                    }
                    for(var b = 0; b < this.listLocal[i].start.length; b++){
                        if(this.listLocal[i].start[b].id == data.uid){
                            num++;
                        }
                    }
                    for(var y = 0; y < this.listLocal[i].center.length; y++){
                        for(var j = 0; j < this.listLocal[i].center[y].controlListHigh.length; j++){
                            if(this.listLocal[i].center[y].controlListHigh[j].id == data.uid){
                                num++;
                            }
                        }
                        for(var c = 0; c < this.listLocal[i].center[y].controlListLow.length; c++){
                            if(this.listLocal[i].center[y].controlListLow[c].id == data.uid){
                                num++;
                            }
                        }
                    }
                }
                if(num > 0){
                    this.$notify({
                        title: '该控制模块被联动功能引用中，请慎重编辑',
                        type: 'warning',
                        duration: 2000
                    });
                    setTimeout(() => {
                        this.groupBox = true
                    }, 2000);
                }else{
                    this.groupBox = true
                }
            }
        },
        // 删除分组模块
        getgroupDel(index,data){
            var num = 0;
            for(var i = 0; i < this.listLocal.length; i++){
                for(var a = 0; a < this.listLocal[i].end.length; a++){
                    if(this.listLocal[i].end[a].id == data.uid){
                        num++;
                    }
                }
                for(var b = 0; b < this.listLocal[i].start.length; b++){
                    if(this.listLocal[i].start[b].id == data.uid){
                        num++;
                    }
                }
                for(var y = 0; y < this.listLocal[i].center.length; y++){
                    for(var j = 0; j < this.listLocal[i].center[y].controlListHigh.length; j++){
                        if(this.listLocal[i].center[y].controlListHigh[j].id == data.uid){
                            num++;
                        }
                    }
                    for(var c = 0; c < this.listLocal[i].center[y].controlListLow.length; c++){
                        if(this.listLocal[i].center[y].controlListLow[c].id == data.uid){
                            num++;
                        }
                    }
                }
            }
            if(num > 0){
                this.$notify({
                    title: '该控制模块被联动功能引用中，请勿删除',
                    type: 'warning',
                    duration: 2000
                });
                return false
            }
            this.loading = true //等待动画
            this.groupList.splice(index, 1)
            var params = {
                    "setlayout":"layout8",
                    "layout":{
                        'type':'delGroupModel',
                        "delGroupModel":{
                            'uid':data.uid
                        }
                    },
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    this.getData();
                    this.$notify({
                        title: '删除成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '删除失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                }
            });
        },
        //控制模块重复打开后清空已选内容
        itemFocus(){
            this.cascaderMean = []
            this.getlist('list');//获取设备列表
            // console.log(this.$refs["cascader"].getCheckedNodes()[0])
        },
        //分组选择子项
        itemChange(data){
            this.groupContral = ''
            this.groupValue = '0'
            this.groupValue2 = ''
            this.dictionary = []
            // 查重
            var ss = 0
            for(var b = 0; b < this.groupListdata.unit.length; b++){
                if((this.groupListdata.unit[b].devType == data[0])
                &&(this.groupListdata.unit[b].devUid == data[1])
                &&(this.groupListdata.unit[b].id == data[2])
                &&(this.groupListdata.unit[b].devAddr == this.addr)
                ){
                    ss = 1
                    this.$notify({
                        title: '子项选择重复',
                        type: 'warning',
                        duration: 1500
                    });
                    this.cascaderMean = []
                }
            }
            if(ss == 0){
                // 字典更新
                this.dictionary = []
                for(var i = 0; i < dictionaryData.length; i++){
                    if(data[0] == dictionaryData[i].type){
                        for(var b = 0; b < dictionaryData[i].children.length; b++){
                            if(data[2] == dictionaryData[i].children[b].id){
                                this.dictionary = dictionaryData[i].children[b].operate
                            }
                        }
                    }
                }
                var ss = 0
                for(var a = 0; a < this.dictionary.length; a++){
                    if(this.dictionary[a].value == this.groupValue){
                        this.groupCarryName = this.dictionary[a].label
                        ss++
                    }
                }
                if(ss == 0){
                    this.groupCarryName = "自定义"
                }
                // }
            }
            

        },
        //输入操作值
        getValue(data){
            var n = 0
            for(var i = 0; i < this.dictionary.length; i++){
                if(data == this.dictionary[i].value ){
                    n++
                    this.groupCarryName = this.dictionary[i].label
                    this.groupContral = this.dictionary[i].value
                }
            }
            if(n == 0){ 
                this.groupContral = ''
                this.groupCarryName = '自定义'
            }
            this.groupValue = data
            this.groupValue2 = ''
        },
        //选择字典
        getSelect(data){
            this.groupValue = data
            for(var i = 0; i < this.dictionary.length; i++){
                if(data == this.dictionary[i].value){
                    this.groupCarryName = this.dictionary[i].label
                }
            }
            this.linkDictionary = false
            this.groupValue2 = ''
        },
        // 分组选择
        groupChange(val){
            if(val.length == 0){
                this.$notify({
                    title: '未选择设备子项',
                    type: 'warning',
                    duration: 1500
                });
                return false
            }else{
                var labels = this.$refs["cascader"].getCheckedNodes()[0].pathLabels
                var ss = ''
                if(this.groupCarryName == '自定义'){
                    ss = this.groupValue
                }else{
                    ss = this.groupCarryName +''+ this.groupValue
                }
                var unit = {
                    devType:val[0],
                    moduleName:labels[0],
                    devUid:val[1],
                    devAddr:this.$refs["cascader"].getCheckedNodes()[0].data.addr,
                    devName:labels[1],
                    id:val[2],
                    idName:labels[2],
                    value:this.groupValue,
                    carryName:ss
                }
                this.groupListdata.unit.push(unit)
                this.cascaderMean = []
                this.dictionary = []
                this.groupValue = ''
                this.groupContral = ''
                this.groupCarryName = ''
            }
        },
        //分组删除
        groupDel(index){
            this.groupListdata.unit.splice(index, 1)
        },
        //分组保存
        groupSave(index){
            if(index == 0){ //关闭控制模块设置弹框
                this.groupBox = false
                this.getData();
            }else if(index == 1){
                if(this.groupListdata.name == '' || this.groupListdata.unit.length == 0){
                    this.$notify({
                        title: '模块内容未填写全',
                        type: 'warning',
                        duration: 1500
                    });
                    return false
                }else{
                    if(this.groupBoxTitle == '添加'){
                        this.groupList.push(this.groupListdata)
                        this.loading = true //等待动画
                        this.groupBox = false //关闭设置弹框
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'addGroupModel',
                                    "addGroupModel":this.groupListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '添加成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '添加失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }else if(this.groupBoxTitle == '编辑'){
                        this.loading = true //等待动画
                        this.groupBox = false //关闭设置弹框
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'updateGroupModel',
                                    "updateGroupModel":this.groupListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '保存成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '修改失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }
                }
                 
            }
        },
        // 添加时间模块
        gettimeTab(type,data,index){
            if(type == 0){
                this.timeBox = true
                this.timeBoxTitle = '添加'
                // 生成唯一编号  范围1~9999
                var num = Math.ceil(Math.random()*9998+1)
                for(var i = 0; i < this.timeList.length; i++){
                    if(this.timeList[i].id == num){
                        num = Math.ceil(Math.random()*9998+1) 
                        i = 0
                    }
                }
                this.timeListdata = {
                    "uid":num,//唯一编号
                    "name":"",
                    "unit":[]
                }
                this.timeListdataWeb = {
                    "uid":num,//唯一编号
                    "name":"",
                    "unit":[]
                }
            }else if(type == 1){
                this.timeBoxTitle = '编辑'
                this.timeListdata = data
                this.timeListNum = index
                localStorage.setItem("timeListWeb", JSON.stringify(data));//旧数据储存
                this.timeListdataWeb = {
                    "uid":data.uid,//唯一编号
                    "name":data.name,
                    "unit":[]
                }
                var s = 0;
                for(var i = 0; i < this.listLocal.length; i++){
                    for(var y = 0; y < this.listLocal[i].timeslotList.length; y++){
                        if(this.listLocal[i].timeslotList[y].unit == undefined){
                            if(this.listLocal[i].timeslotList[y].id == data.uid){
                                s++
                            }
                        }
                    }
                }
                if(s > 0 && this.linkList == false){
                    this.$notify({
                        title: '该时间模块被联动功能引用中，请慎重编辑',
                        type: 'warning',
                        duration: 2000
                    });
                    setTimeout(() => {
                        this.timeBox = true
                    }, 2000);
                }else{
                    this.timeBox = true
                }
                for(var y = 0; y < data.unit.length; y++){
                    var arr = {
                        cycleValue:[],//周期级联选择器内容 仅前端页面需要
                        start:'',//仅前端页面需要
                        end:'',//仅前端页面需要
                        week:0,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                        dateValue:'',//日期 仅前端页面需要
                    }
                    if(data.unit[y].cycle == 0){
                        arr.cycleValue=["day"]
                    }else if(data.unit[y].cycle == 1){
                        switch (data.unit[y].week) {
                            case 0:
                                arr.cycleValue=["week","0"];
                                break;
                            case 1:
                                arr.cycleValue=["week","1"];
                                break;
                            case 2:
                                arr.cycleValue=["week","2"];
                                break;
                            case 3:
                                arr.cycleValue=["week","3"];
                                break;
                            case 4:
                                arr.cycleValue=["week","4"];
                                break;
                            case 5:
                                arr.cycleValue=["week","5"];
                                break;
                            case 6:
                                arr.cycleValue=["week","6"];
                        }
                    }else if(data.unit[y].cycle == 2){
                        arr.cycleValue=["date"]
                        arr.dateValue = data.unit[y].date*1000
                    }
                    arr.start = this.ChangeHourMinutestr(data.unit[y].startTime)
                    arr.end = this.ChangeHourMinutestr(data.unit[y].endTime)
                    this.timeListdataWeb.unit.push(arr)
                }
            }            
        },
        //删除时间模块
        gettimeDel(index,uid){
            var s = 0;
            for(var i = 0; i < this.listLocal.length; i++){
                for(var y = 0; y < this.listLocal[i].timeslotList.length; y++){
                    if(this.listLocal[i].timeslotList[y].unit == undefined){
                        if(this.listLocal[i].timeslotList[y].id == uid){
                            s++
                        }
                    }
                }
            }
            if(s > 0){
                this.$notify({
                    title: '该时间模块被联动功能引用中，请勿删除',
                    type: 'warning',
                    duration: 2000
                });
                return false
            }
            this.loading = true //等待动画
            this.timeList.splice(index, 1)
            var params = {
                    "setlayout":"layout8",
                    "layout":{
                        'type':'delTimeModel',
                        "delTimeModel":{
                            'uid':uid
                        }
                    },
                    [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            };
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    this.getData();
                    this.$notify({
                        title: '删除成功',
                        type: 'success',
                        duration: 1500
                    });
                }else{
                    this.$notify({
                        title: '删除失败',
                        type: 'warning',
                        duration: 1500
                    });
                    this.loading = false
                }
            });
        },
        // 添加时间段
        addTime(){
            var untime = {
                cycleValue:[],//周期级联选择器内容 仅前端页面需要
                start:'',//仅前端页面需要
                end:'',//仅前端页面需要
                dateValue:'',//日期 仅前端页面需要
            }
            var untime2 = {
                cycle:0,// 0每天  1每周  2固定日期
                startTime:0,
                endTime:0,
                week:0,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                date:'',//日期
            }
            this.timeListdataWeb.unit.push(untime)
            this.timeListdata.unit.push(untime2)
        },
        //复制时间
        timeCopy(index){
            var untime = {
                cycleValue:this.timeListdataWeb.unit[index].cycleValue,//周期级联选择器内容 仅前端页面需要
                start:this.timeListdataWeb.unit[index].start,//仅前端页面需要
                end:this.timeListdataWeb.unit[index].end,//仅前端页面需要
                dateValue:this.timeListdataWeb.unit[index].dateValue,//日期 仅前端页面需要
            }
            var untime2 = {
                cycle:this.timeListdata.unit[index].cycle,// 0每天  1每周  2固定日期
                startTime:this.timeListdata.unit[index].startTime,
                endTime:this.timeListdata.unit[index].endTime,
                week:this.timeListdata.unit[index].week,//1周一 2周二 3周三 4周四 5周五 6周六 0周天
                date:this.timeListdata.unit[index].date,//日期
            }
            this.timeListdataWeb.unit.push(untime)
            this.timeListdata.unit.push(untime2)
        },
        // 删除时间段
        timeDel(index){
            this.timeListdataWeb.unit.splice(index, 1);
            this.timeListdata.unit.splice(index, 1);
        },
        //时间周期选择
        timeChange(index,data){
            if(data.cycleValue[0]=='day'){
                this.timeListdata.unit[index].cycle = 0
            }else if(data.cycleValue[0]=='week'){
                this.timeListdata.unit[index].cycle = 1
                this.timeListdata.unit[index].week = Number(data.cycleValue[1])
            }else if(data.cycleValue[0]=='date'){
                this.timeListdata.unit[index].cycle = 2
            }
        },
        //时间选择后触发
        changeTime(event,type,index){
            if(type == 'start'){//开始时间转换
                this.timeListdata.unit[index].startTime = this.timeConvert(event)
            }else if(type == 'end'){//结束时间转换
                this.timeListdata.unit[index].endTime = this.timeConvert(event)
            }
        },
        //日期选择后触发
        dateChangt(index,data){
            this.timeListdata.unit[index].date = data.dateValue/1000
        },
        //分钟转换为 00:00 格式
        ChangeHourMinutestr(str) {
            if (str !== "0" && str !== "" && str !== null) {
                return (
                (Math.floor(str / 60).toString().length < 2
                    ? "0" + Math.floor(str / 60).toString()
                    : Math.floor(str / 60).toString()) +
                ":" +
                ((str % 60).toString().length < 2
                    ? "0" + (str % 60).toString()
                    : (str % 60).toString())
                );
            } else {
                return " ";
            }
        },
        //保存时时间转换 00:00 → 0
        timeConvert(time){
            var hour = time.split(":")[0];
            var min = time.split(":")[1];
            var second = Number(hour * 3600) + Number(min * 60);
            var t = second/60
            return t
        },
        timeDate(date){
            var dateDate = this.formatDate(date*1000, 'YYYY-MM-DD'); 
            return dateDate
        },
        
        //时间模块保存
        timeSave(index){
            if(index == 0){ // 时间设置框取消
                this.timeBox = false
                if(this.timeBoxTitle == '编辑'){
                    var arr = JSON.parse(localStorage.getItem("timeListWeb"));
                    this.timeList[this.timeListNum] = arr
                }
                
            }else if(index == 1){ // 时间保存
                var s = 0
                for(var i = 0; i < this.timeListdata.unit.length; i++){
                    if(this.timeListdata.unit[i].endTime == ""){
                        this.timeListdata.unit[i].endTime = 0
                    }
                    if(this.timeListdata.unit[i].startTime == ""){
                        this.timeListdata.unit[i].startTime = 0
                    }
                    if(this.timeListdata.unit[i].cycle == 2 && this.timeListdata.unit[i].date == ""){
                        s++;
                    }
                }
                if(s > 0){
                    this.$notify({
                        title: '监测有日期未选择，请检查后保存',
                        type: 'warning',
                        duration: 1500
                    });
                }else if(this.timeListdata.unit.length == 0){
                    this.$notify({
                        title: '监测未添加时间段，请检查后保存',
                        type: 'warning',
                        duration: 1500
                    });
                }else if(this.timeListdata.name == ""){
                    this.$notify({
                        title: '监测名称未填写，请检查后保存',
                        type: 'warning',
                        duration: 1500
                    });
                }else{
                    for(var y = 0; y < this.timeList.length; y++){
                        if(this.timeListdata.name == this.timeList[y].name){
                            if(this.timeListdata.uid != this.timeList[y].uid){
                                this.$notify({
                                    title: '监测名称填写重复，请修改后保存',
                                    type: 'warning',
                                    duration: 1500
                                });
                                return false
                            }
                            
                        }
                    }
                    this.loading = true //等待动画
                    this.timeBox = false //关闭编辑设置弹框
                    //this.timeListdata 正在修改或添加的内容
                    if(this.timeBoxTitle == '添加'){
                        this.timeList.push(this.timeListdata)
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'addTimeModel',
                                    "addTimeModel":this.timeListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '添加成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '添加失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }else if(this.timeBoxTitle == '编辑'){ //this.timeListNum 正在编辑的编号
                        this.timeList[this.timeListNum] = this.timeListdata
                        var params = {
                                "setlayout":"layout8",
                                "layout":{
                                    'type':'updateTimeModel',
                                    "updateTimeModel":this.timeListdata
                                },
                                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        };
                        this.$http.post(this.$baseUrl, params).then((res) => {
                            if(res.data.result == 'ok'){
                                this.getData();
                                this.$notify({
                                    title: '保存成功',
                                    type: 'success',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '修改失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                                this.loading = false
                            }
                        });
                    }
                    // this.boxor = false //等待setData返回结果的标志，现已不需要
                }
            }
        },
        
    },
    // 清除定时器
    beforeDestroy() {
        // 停止循环接口
        clearInterval(this.timeListFixed);
        this.timeListFixed = null;
        // 停止循环接口
        clearInterval(this.timeSysData);
        this.timeSysData = null;
    },
}
</script>

<style scoped>
    /* 数据加载样式 */
    /deep/ .el-loading-spinner i{
        color: #fff !important;
    }
    /deep/ .el-loading-spinner .el-loading-text{
        color: #fff !important;
    }
    /deep/ .el-input__inner {
        /* background: none !important; */
        border: none !important;
        /* height: 30px !important;
        line-height: 30px !important; */
    }
    .button{
        float: right;
        margin-top: 20px;
    }
    /deep/ .el-table--border th{
        background: rgba(35, 78, 107, 0.6);
        color: #fff;
    }
    .zhushi{
        padding: 10px;
        font-size: 14px;
        margin-top: 100px;
    }
    .zhushi h4{
        color: red;
        line-height: 30px;
        margin: 0px;
    }
    .zhushi p{
        color: #fff;
        line-height: 26px;
        margin: 0;
    }
    /deep/ .el-table th, /deep/  .el-table tr{
        background-color: transparent !important;
        color: #fff;
    }
    /deep/ .el-table, .el-table__expanded-cell{
        background-color: transparent !important;
    }
    /deep/ .el-table__header-wrapper{
        background-color: #5981a533 !important;
        border-bottom: none;
    }
    /deep/ .el-table td, .el-table th.is-leaf{
        border-bottom: 1px solid #ebeef542;
        background-color: transparent !important;
    }
    /deep/ .el-table--enable-row-hover .el-table__body tr:hover>td{
        background: #7f94ad;
    }
    /deep/ .el-table--striped .el-table__body tr.el-table__row--striped td {
        background: #4e6888;
    }
    
    /deep/ .el-table tr th.is-leaf{
        border: none;
    }
    /deep/ .el-table--border{
        border: none;
    }
    /* 按钮 */
    /deep/ .el-button--primary.is-disabled, .el-button--primary.is-disabled:active, .el-button--primary.is-disabled:focus, .el-button--primary.is-disabled:hover{
        background-color: rgba(89, 129, 165, 0.5);
        border-color: none;
    }
    
     /* 清除底部横线 */
    .el-table::before {
        height: 0px;
    }
    .el-table--border::after{
        display: none;
    }
 /deep/ .el-button{
        background: rgba(89, 129, 165, 0.8);
        border: none;
    }
/deep/ .linktable{
    font-size: 16px;
    background: none;
    border: none;
}
    /deep/ .el-dialog {
  background: rgba(79, 112, 151, 0.4) !important;
}
/deep/ .el-dialog__header {
  background: rgba(0, 0, 0, 0.2);
  color: #fff !important;
}
/deep/ .el-dialog__header .el-dialog__title {
  color: #fff !important;
}
/deep/ .el-form-item__label {
  color: #fff !important;
}
/deep/ .el-dialog__body{
        padding: 30px ;
        padding-top: 0px;
        /* padding: 30px 100px 30px 40px; */
}
/*  */
.warning_link{
    /* display: flex; */
    height: 750px;
}
.link_list_add{
    height: 50px;
}
.config_title_add{
    float: right;
    font-size: 30px;
    cursor: pointer;
}
.config_title_add .el-icon-circle-plus-outline:hover{
    color: #409EFF;
}
.linkList{
    display: flex;
    flex-flow:row wrap;
    /* padding-left: 80px; */
    width: 90%;
    margin: 0 auto;
    height: 650px;
    padding-right: 10px;
    overflow: hidden;
    overflow-y: scroll;
    justify-content: space-between;
}
.linkList_eidt{
    width: 45%;
    height: 200px;
    /* background: #8096a861; */
    background: #3b4e5e;
    border-radius: 10px;
    margin-top: 20px;
}
.linkList_eidt_flex{
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.linkList_activity{
    width: 80%;
    padding-left: 40px;
    display: flex;
}
.linkList_ac{
    height: 130px;
    width: 40px;
    display: flex;
    align-items: center;
}
.linkList_name{
    height: 70px;
    line-height: 65px;
    font-size: 22px;
    padding: 20px 40px;
    padding-bottom: 0px;
    overflow: hidden;
}
.linkList_nr{
    width: 80%;
    margin-left: 40px;
    overflow: hidden;
    white-space:nowrap;
    text-overflow:ellipsis; 
    padding-top: 10px;
    display: flex;
    /* justify-content: center; */
}
.linkList_nr_flex{
    width: 100%;
}
.linkList_nr_div{
    height: 50px;
    line-height: 50px;
}
.linkList_but{
    width: 20%;
    font-size: 20px;
    text-align: center;
}
.el-icon-edit-outline{
    cursor: pointer;
}
.linkList_but_delete{
    margin-left: 10px;
    cursor: pointer;
}

/* 联动子项与选项卡样式 */
.link_tab{
    width: 100%;
    height: 100%;
    /* background: #7f94ad; */
}
.link_tabs{
    background: #9bc0db14;
    height: 100%;
    border: 1px solid #45596a;
}
/deep/ .el-tabs__item{
    height: 60px;
    line-height: 60px;
}
/deep/ .el-tabs--border-card>.el-tabs__header{
    background-color:#0000;
    border-bottom: 1px solid #45596a;
}
/deep/ .el-tabs--border-card>.el-tabs__header .el-tabs__item{
    font-size: 16px;
}
/deep/ .el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{
    color: #ffffff;
    background-color: #334b5e;
    border-right-color: #45596a;
    border-left-color: #45596a;
}
/deep/ .el-dialog__body,.el-button{
    color: #fff !important;
}
/deep/.link_t .el-input {
    width: 80%;
}   
/* 弹框 */
.link_flex{
    display: flex;
    flex-flow:row wrap;
}
.link_flex_top{
    width: 100%;
    margin-bottom: 15px;
    margin-left: 30px;
    display: flex;
    flex-wrap:wrap;
}
.link_massage{
    width: 54%;
}
.link_t{
    overflow: hidden;
    /* overflow-y: scroll; */
    max-height: 710px;
    padding: 0px 30px;
}
.link_t .el-radio{
    color: #fff;
}
.link_t_div{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
    position: relative;
}
.link_t_div_alert{
    position: absolute;
    top: 0px;
    width: 100%;
    z-index: 9;
}
.link_t_div_alert_w{
    position: relative;
}
.link_t_div_alert_x{
    position: absolute;
    top: 0px;
    right: 0px;
    color: #E6A23C;
    width: 30px;
    text-align: center;
    height: 35px;
    line-height: 32px;
    cursor: pointer;
}

.el-icon-zoom-in{
    cursor: pointer;
}
.link_adddiv{
    display: flex;
    margin-bottom: 10px;
    align-items: center;
}
.link_item{
    width: 46%;
    /* padding: 5px 10px; */
}
.link_item .link_adddiv{
    margin-bottom: 20px;
}
.link_adddiv_time{
    margin-left: 30px;
}
.link_adddiv_time .el-form-item{
    margin-bottom: 0px;
}
.link_itemgl .el-form-item{
    margin-bottom: 10px;
}
.link_item_name{
    width: 80%;
    margin: 0 auto;
    position: relative;
    padding-right: 20px;
}
.link_item_name .el-icon-question{
    position: absolute;
    top: 14px;
    cursor: pointer;
}
.link_item_div{
    border: 1px dashed #8ea6c2;
    width: 100%;
    padding-bottom: 20px;
    overflow-y: scroll;
}
/deep/ .link_top{
    padding: 6px 5px;
    margin-left: 0px !important;
    background: rgba(89, 129, 165, 0.5)
}
.link_add{
    width: 25px;
    cursor: pointer;
    font-size: 20px;
    padding-right: 5px;
}
.link_line{
    width: 8%;
    display: flex;
    align-items: center;
    flex-flow:row wrap;
}
.link_line div{
    width: 100%;
    
    text-align: center;
}
.link_line_j1{
    display: block;
    }
.link_line_j2{
    display: none;
}
.link_control{
    width: 46%;
    /* padding: 5px 10px; */
    /* display: flex; */
}
/* 新逻辑弹框样式 */
.link_box{
    height: 700px;
}
.link_box_table{
    width: 100%;
    border: 1px dashed #ffffff70;
    /* border-bottom: 1px dashed #fff; */
    border-radius: 20px;
}
.link_box_name{
    margin-top: 25px;
}
.link_box_timez{
    width: 95%;
    margin: 0 auto;
}
.link_box_timez img{
    width: 100%;
}
.link_box_title{
    display: flex;
    text-align: center;
}
.link_box_start,.link_box_end{
    width: 100%;
    height: 40px;
    line-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px dashed #ffffff70;
}
.link_box_time_logic{
    border-bottom: 1px dashed #ffffff70;
    height: 150px;
    padding: 15px 3%;
    padding-top: 0px;
    overflow: hidden;
    position: relative;
}
.link_box_tlogic_conflex{
    width: 100%;
    position: relative;
}
.link_box_tlogic{
    height: 100%;
    overflow: hidden;
    padding-right:2%;
    padding-top: 10px;
}
.link_box_tlogic_timeflex{
    height: 100%;
    overflow: hidden;
    overflow-y: scroll;
    display: flex;
    flex-flow:row wrap;
    justify-content: space-between;
    padding-right: 10px;
    padding-bottom: 10px;
}
.link_box_tlogic_add{
    position: absolute;
    right: 10px;
    top: 5px;
}
.link_box_tlogic_timefor{
    width: 47%;
    height: 50px;
    margin-top: 10px;
    margin-left: 10px;
    position: relative;
}
.link_box_tlogic_timefor_reprat{
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: #3e49521f;
}
.link_box_tlogic_timefor span{
    padding: 10px;
    /* 不换行 */
    white-space: nowrap;
    /* 溢出隐藏 */
    overflow: hidden;

}
.link_box_tlogic_timefor_unit{
    display: flex;
    align-items: center;
    justify-content: space-around;
}
.link_box_tlogic_timefor div{
    flex: 1;
}
/* .link_box_tlogic_timefor:nth-child(1){
    margin-top: 0px;
}
.link_box_tlogic_timefor:nth-child(2){
    margin-top: 0px;
} */
.link_box_tlogic_timefor_del{
    width: 20px;
    height: 20px;
    cursor: pointer;
    text-align: center;
    position: absolute;
    top: 0px;
    right: 0px;
    color: #b5b5b5;
}
/* .link_time_repeat{
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0px;
    right: 0px;
    border: 2px solid #ff5d00;
    box-shadow: 0px 0px 5px 0px #ff5d00;
    z-index: -1;
} */
.link_box_tlogic_add_p{
    cursor: pointer;
    font-size: 20px;
}
.link_box_tlogic_choose{
    height: 50px;
}
/deep/ .el-radio{
    color: #fff;
}
.link_box_tlogic_item{
    margin-bottom: 10px;
    width: 100%;
    display: flex;
}
/deep/ .link_box_tlogic_item .el-input{
    width: 100%;
}
/deep/ .link_box_tlogic_item .el-cascader{
    width: 100%;
}
.link_box_logic{
    height: 440px;
    display: flex;
    text-align: center;
}
.link_box_soperate,.link_box_eoperate{
    width: 23%;
    height: 430px;
    overflow: hidden;
    /* padding-top: 20px; */
}
.link_box_loperate{
    width: 56%;
    padding: 20px 0;
    border-right: 1px dashed #ffffff70;
    border-left: 1px dashed #ffffff70;
}
.link_box_start_add{
    padding: 15px 8%;
    position: relative;
}
.link_box_logic_control{
    width: 100%;
    height: 390px;
    margin: 0 auto;
    overflow: hidden;
    overflow-y: scroll;
}
.link_box_logic_control_bottom{
    height: 225px;
    position: relative;
    padding-top: 20px;
    overflow: hidden;
}
.link_box_logic_control_bottom .link_box_logic_control{
    height: 180px;
}
.link_box_logic_control_item{
    background: #3e49521f;
    width: 100%;
    height: 70px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}
.link_box_logic_control_name{
    width: 85%;
    overflow: hidden;
    height: 70px;
    line-height: 70px;
    padding-left: 5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.link_box_logic_control_flex{
    width: 15%;
    text-align: center;
    font-size: 17px;
    line-height: 29px;
    padding-right: 10px;
    padding-top: 5px;
    /* display: flex;
    justify-content: space-between; */
}
.el-icon-delete{
    cursor: pointer;
}
.link_box_logic_control_edit{
    font-size: 18px;
    flex: 1;
    text-align: right;
}
.link_box_logic_item_left{
    width: 80%;
}
.link_box_logic_contrlo_name{
    width: 100%;
    display: flex;
    overflow: hidden;
}
.link_box_logic_contrlo_name p{
    width: 100%;
    font-size: 15px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.link_box_logic_contrlo_div{
    height: 100%;
    padding: 0px 2px;
    text-align: center;
    display: flex;
}
.link_box_logic_edit{
    font-size: 18px;
}
.link_box_logic_item{
    background: #3e49521f;
    width: 100%;
    height: 80px;
    line-height: 30px;
    margin-top: 20px;
    text-align: left;
    display: flex;
    padding: 5px 30px  5px 20px;
    position: relative;
    align-items: center;
    justify-content: space-between;
}
.link_box_logic_item:nth-child(1){
    margin-top: 0px;
}
.link_box_logic_item_left{

}
.link_box_logic_flex_del{
    width: 7%;
    height: 100%;
}
.link_box_logic_cf{
    height: 30px;
    line-height: 30px;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow:ellipsis; 
}
/* 联动数据时间选择 */
.link_time_right{
    width: 46%;
    /* display: flex; */
}
.link_time_title{
    min-width: 100px;
    text-align: right;
}
.link_time_nr{
    width: 100%;
}
.link_time_add{
    font-size: 20px;
    width: 50px;
}
.link_time_add i{
    position: relative;
    top: -3px;
    cursor: pointer;
}
.link_time_show{
    width: 100%;
    height: 200px;
    border: 1px dashed #8ea6c2;
    display: flex;
    flex-flow:row wrap;
    padding:20px 35px;
    justify-content:space-between;
}
.link_time_div{
    width: 260px;
    height: 50px;
    line-height: 50px;
    background: #3e49521f;
    display: flex;
}
.link_time_name{
    width: 190px;
    padding-left: 10px;
}
.link_time_contorl{
    width: 70px;
    font-size: 18px;
    text-align: center;
}

/* 平均值模块 */
.meanTab{
    width: 100%;
    height: 100%;
    /* background: #7f94ad; */
    /* padding: 10px 20px; */
}
.meanTab_add{
    height: 50px;
}
.meanTabList{
    display: flex;
    flex-flow:row wrap;
    padding-left: 80px;
    height: 250px;
    overflow: hidden;
    overflow-y: scroll;
}
.link_numput{
    width: 100%;
    display: flex;
}
.meanTab_eidt{
    width: 360px;
    height: 70px;
    /* background: #8096a861; */
    background: #3b4e5e;
    border-radius: 10px;
    margin-top: 20px;
    margin-right: 80px;
    display: flex;
    align-items: center;
}
.meanTab_eidt:nth-child(1){
    margin-top: 0px;
}
.meanTab_eidt:nth-child(2){
    margin-top: 0px;
}
.meanTab_eidt:nth-child(3){
    margin-top: 0px;
}
/* .meanTab_eidt:nth-child(4){
    margin-top: 0px;
} */
.meanTab_name{
    width: 250px;
    margin-left: 20px;
    overflow: hidden;
}
.meanTab_time{
    width: 130px;
}
.meanTab_but{
    width: 70px;
    font-size: 20px;
}
.meanTab_but_delete{
    margin-left: 10px;
}
/* 平均值弹框 */
/deep/ .meanBox_input .el-input {
    width: 60%;
}   
.mean_flex{
    height: 270px;
    overflow: hidden;
    /* overflow-y: scroll; */
    border: 1px solid #8a9bae;
    margin-left: 60px;
    padding: 10px;
}
.meanflex{
    display: flex;
    flex-flow:row wrap;
    max-height: 250px;
    overflow-y: scroll;
    padding-bottom: 10px;
    
}
.meanflexBox{
    width: 40%;
    height: 40px;
    line-height: 40px;
    border: 1px dashed #d1d1d173;
    padding: 0px 10px;
    padding-right: 20px;
    margin-right: 20px;
    margin-top: 20px; 
    border-radius: 5px;
    position: relative;
}
.meanflexBox:nth-child(1){
    margin-top: 10px;
}
.meanflexBox:nth-child(2){
    margin-top: 10px;
}
.meanflexBox_titile{
    width: 100%;
    overflow: hidden;
    white-space:nowrap;
}
.meanflexBox_del{
    width: 20px;
    text-align: center;
    height: 40px;
    line-height: 20px;
    position: absolute;
    right: 0px;
    top: 0px;
    cursor: pointer;
}
/* 分组模块 */
.group_valueclass{
    height: 40px;
    margin-left: 15px;
}
.group_dialog{
    margin-top: 20px;
}
.linkcontrol_help{
    margin-left: 10px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
}
.linkcontrol_help .el-button{
    cursor: pointer;
    background: rgba(119, 141, 161, 0.8);
}
/* 时间模块弹框 */
.time_add{
    font-size: 24px;
}
.time_del{
    font-size: 20px;
    margin-left: 5px;
    cursor: pointer;
}
.time_item{
    margin-bottom: 10px;
    border-bottom: 1px dashed #fff;
    width: 100%;
    display: flex;
}
.time_item:first-child{
    margin-top: 10px;
}
.time_title div{
    height: 50px;
    line-height: 50px;
    font-size: .072917rem /* 14/192 */
}
.time_item_div{
    width: 78%;
}
.time_item_div_flex{
    display: flex;
    height: 50px;
    line-height: 50px;
}
.time_zz_flex{
    width: 220px;
}
.time_item_dele{
    width: 10%;
    height: 100px;
    line-height: 100px;
    padding-left: 10px;
}
/deep/ .time_item .el-input{
    width: 100%;
}
/deep/ .time_item .el-cascader{
    width: 100%;
}
.time_date{
    margin-left: 10px;
}
.clickD{
    cursor: pointer;
}
/* 空气质量 */
.airlimit{
    display: flex;
    height: 100px;
    line-height: 100px;
    align-items: center;
}
.airlimit_title{
    width:300px;
    text-align: right;
    padding-right: 40px;
}
.airlimit_value{
    width:200px;
    height: 50px;
    font-size:24px;
    color:#fff;
    border: 1px solid #fff !important;
    position: relative;
}
/deep/ .airlimit_value .el-input{
    height: 50px;
    position: absolute;
    top:0;
}
/deep/ .airlimit_value .el-input .el-input__inner{
    background-color: #fff0 !important;
    height: 50px;
    position: absolute;
    top:0;
    color:#fff;
    font-size: 18px;
}
.airlimit_save{
    width: 500px;
    text-align: right
}
/* 媒体查询 */
@media screen and (max-width: 1280px) {
    .link_massage{
        width: 100%;
    }
    .link_time_right{
        width: 100%;
    }
    .link_item{
        width: 100%;
    }
    .link_line{
        width: 100%;
        margin-top: 45px;
    }
    .link_control{
        width: 100%;
    }
    .link_line_j1{
        display: none;
    }
    .link_line_j2{
        display: block;
    }
    .link_box_tlogic_timefor{
        width: 100%;
    }
    .link_box_tlogic_timefor:nth-child(2){
        margin-top: 10px;
    }
    /* .link_box_logic_item{
        display: block;
        height: 110px;
        padding: 10px 30px 10px 20px;
    }
    .link_box_logic_contrlo_div{
        line-height: 45px;
        height: 45px;
    } */
}
</style>